Method and apparatus for maintaining network connections between devices

ABSTRACT

A data-forwarding system establishes a network connection to a plurality of network devices to facilitate an interfacing device communicating with a device-controlling system, a peer interfacing device, or other computing devices. During operation, when the system receives data from a network device, the system determines a peer network device that is to receive the data, such as a device that is subscribed to receive the data. The system can forward the sensor data to the peer network device by determining an established network connection for communicating with the second network device, and sending the sensor data to the peer network device via the established network connection.

RELATED APPLICATIONS

This application claims the benefit of U.S. Provisional Application No.61/665,238, Attorney Docket Number UBNT12-1003PSP, entitled “INTELLIGENTSENSOR CONTROL SYSTEM,” by inventors Randall W. Frei, Linker Cheng, andRobert J. Pera, filed 27 Jun. 2012;

U.S. Provisional Application No. 61/665,839, Attorney Docket NumberUBNT12-1003.2PSP, entitled “SYSTEM AND METHOD FOR INTELLIGENT CONTROL OFDEVICES,” by inventors Randall W. Frei, Linker Cheng, and Robert J.Pera, filed 28 Jun. 2012;

U.S. Provisional Application No. 61/716,429, Attorney Docket NumberUBNT12-1003.3PSP, entitled “SYSTEM AND METHOD FOR INTELLIGENT CONTROL OFDEVICES,” by inventors Randall W. Frei, Linker Cheng, and Robert J.Pera, filed 19 Oct. 2012;

U.S. Provisional Application No. 61/665,772, Attorney Docket NumberUBNT12-1004PSP, entitled “INTELLIGENT SENSOR COMMUNICATION SYSTEM,” byinventors Randall W. Frei, Linker Cheng, and Robert J. Pera, filed 28Jun. 2012;

U.S. Provisional Application No. 61/665,769, Attorney Docket NumberUBNT12-1005PSP, entitled “INTELLIGENT POWER MONITOR AND CONTROL SYSTEM,”by inventors Randall W. Frei, Linker Cheng, and Robert J. Pera, filed 28Jun. 2012; and

U.S. Provisional Application No. 61/716,392, Attorney Docket NumberUBNT12-1005.2PSP, entitled “NETWORK-CONTROLLABLE INTELLIGENT POWERDEVICES,” by inventors Randall W. Frei, Linker Cheng, and Robert J.Pera, filed 19 Oct. 2012.

The subject matter of this application is related to the subject matterof the following co-pending non-provisional applications by the sameinventors as the instant application and filed on the same day as theinstant application:

U.S. patent application No. TO BE ASSIGNED (Attorney Docket No.UBNT12-1003NP), entitled “METHOD AND APPARATUS FOR CONFIGURING ANDCONTROLLING INTERFACING DEVICES,” by inventors Randall W. Frei, LinkerCheng, and Robert J. Pera, having filing date TO BE ASSIGNED;

U.S. patent application No. TO BE ASSIGNED (Attorney Docket No.UBNT12-1003.3NP), entitled “METHOD AND APPARATUS FOR DISTRIBUTED CONTROLOF AN INTERFACING-DEVICE NETWORK,” by inventors Randall W. Frei, LinkerCheng, and Robert J. Pera, having filing date TO BE ASSIGNED;

U.S. patent application No. TO BE ASSIGNED (Attorney Docket No.UBNT12-1003.4NP), entitled “METHOD AND APPARATUS FOR MONITORING ANDPROCESSING SENSOR DATA IN AN INTERFACING-DEVICE NETWORK,” by inventorsRandall W. Frei, Linker Cheng, and Robert J. Pera, having filing date TOBE ASSIGNED;

U.S. patent application No. TO BE ASSIGNED (Attorney Docket No.UBNT12-1003.5NP), entitled “METHOD AND APPARATUS FOR MONITORING ANDPROCESSING SENSOR DATA USING A SENSOR-INTERFACING DEVICE,” by inventorsRandall W. Frei, Linker Cheng, and Robert J. Pera, having filing date TOBE ASSIGNED;

U.S. patent application No. TO BE ASSIGNED (Attorney Docket No.UBNT12-1003.6NP), entitled “METHOD AND APPARATUS FOR CONTROLLING POWERTO AN ELECTRICAL LOAD BASED ON SENSOR DATA,” by inventors Randall W.Frei, Linker Cheng, and Robert J. Pera, having filing date TO BEASSIGNED; and

U.S. patent application No. TO BE ASSIGNED (Attorney Docket No.UBNT12-1003.7NP), entitled “METHOD AND APPARATUS FOR MONITORING ANDPROCESSING SENSOR DATA FROM AN ELECTRICAL OUTLET,” by inventors RandallW. Frei, Linker Cheng, and Robert J. Pera, having filing date TO BEASSIGNED.

BACKGROUND

1. Field

This disclosure is generally related to the control of multiple devices.More specifically, this disclosure is related to intelligent control ofthe multiple devices.

2. Related Art

Home automation, or smart homes, has enhanced quality of life of theirusers. More specifically, a home automation system enables centralizedcontrol of lighting, HVAC (heating, ventilation, and air conditioning),appliances, and other systems, thus providing improved convenience,comfort, energy efficiency, and security. Some automation systemsprovide a way to automate the control of a device based on timed orenvironmental factors, such as in an HVAC unit or a sprinkler system.However, these typical automation systems provide automated control foran individual type of appliance, and the different automation systems donot interface with one another to provide a complete home automationsolution.

In contrast, in a smart home, all electrical devices/appliances in thehouse are integrated together to provide convenience and a better livingexperience for its users. Moreover, the ubiquitousness of the Internetconnection has also made it possible for a user to monitor and/orcontrol his home remotely.

For example, while vacationing in Europe, a user may connect to asurveillance system for his home at Washington D.C. to monitoractivities in his home; or the user may turn off his home sprinklersystem in response to receiving a storm forecast for the Washington D.C.area.

Typical home automation technologies are often implemented usingspecially designed control and monitor devices that communicate with oneanother using a dedicated communication protocol. Because thiscommunication protocol between devices is proprietary, home owners arehaving trouble to customize the system to include new or differentmonitor devices from other vendors. In the example of the homesurveillance system, the surveillance system controller is connected tovarious specially designed sensors and/or cameras that are manufacturedby the same vendor. Moreover, to implement the centralized control, theappliances (or at least the controllers for each appliance) also need tobe manufactured by the same vendor. In the aforementioned example, thehome surveillance system and the sprinkler system (or the controllersfor these systems) have to be the products of the same vendor to allowthe user to access both systems using a single interface. However,installing these dedicated devices or appliance controllers can becostly and wasteful as many existing homes may already be equipped withsensors and appliances that are manufactured by various differentvendors.

SUMMARY

One embodiment of the present invention provides a device-controllingsystem that configures, monitors, and/or controls one or moreinterfacing devices. An interfacing device can obtain and disseminatesensor data from one or more attached physical devices, such as devicesthat include sensors for measuring physical attributes. Duringoperation, the system can configure an interfacing device byestablishing a network connection with the interfacing device, andselecting one or more rules that are to be processed by the interfacingdevice. The system configures the interfacing device to process itsassociated rules.

One embodiment of the present invention provides a system thatestablishes a network connection to a plurality of network devices tofacilitate an interfacing device communicating with a device-controllingsystem, a peer interfacing device, or other computing devices. Thesystem can receive data from a network device, and forwards the data toa peer network device that is subscribed to the data. The system sendsthe data to the peer network device via a network connection that hasbeen established with the peer network device.

One embodiment of the present invention provides an interfacing devicethat communicates with other devices over an established networkconnection to send and/or receive real-time sensor data. Duringoperation, the local device can establish a network connection with aremote network device, such as with a peer interfacing device, or adata-forwarding system. The local device can maintain data subscriptionsto other peer devices to obtain real-time data elements associated witha rule, such as by sending a data-subscription request to a peer networkdevice that generates a data element, via the established networkconnection.

One embodiment of the present invention provides a local controller thatmaintains a local database which stores information associated with aset of interfacing devices of a local-area network. The local databasecan include a database mirror for a remote database, of a remotecontroller, that stores information for a set of provisioned interfacingdevices. During operation, the local controller maintains the localdatabase synchronized with at least a subset of the remote database.However, when the local controller determines that the remote controllerhas gone offline, if the remote controller has primary control ofinterfacing devices in the local area network, the local controller canobtain primary control of the interfacing devices within the local areanetwork.

One embodiment provides an interfacing device that is configured toprocess one or more rules, based on sensor data, to perform apredetermined action. During operation, the device can receive a deviceconfiguration that includes a rule for the interfacing device. The rulecan include an action description for performing an action, and caninclude a condition that takes sensor data as input and indicatescriteria for performing the action. The device can store the rule in arule repository, and determines a remote interfacing device thatgenerates a piece of data associated with the rule's condition. Thedevice can also subscribe to the piece of data from the remoteinterfacing device.

One embodiment provides a sensor-monitoring interfacing device, coupledto one or more physical devices that include sensors for measuringphysical attributes. During operation, the interfacing device obtainsand processes sensor data from the physical devices. When theinterfacing device determines that a rule's condition is satisfied basedon the sensor data, the interfacing device can process the rule's actiondescription to perform a corresponding action.

One embodiment provides a load-controlling interfacing device thatobtains and processes sensor data received from a user interface and/orfrom a remote interfacing device. During operation, the load-controllinginterfacing device processes rules based on the sensor data to controlan electrical load, such as a light fixture.

One embodiment provides a load-monitoring interfacing device thatobtains and processes sensor data from an electrical load. Theinterfacing device can include at least one power outlet to providepower to a corresponding electrical load. During operation, theinterfacing device can obtain sensor data from a local power outletcoupled to an electrical load, such that the sensor data can indicate anelectrical measurement associated with the electrical load. Theinterfacing device can process a rule associated with the sensor data,such as to enable or disable a power outlet, or to perform any otherpre-defined action.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1A illustrates an exemplary system architecture of amonitor-and-control system in accordance with an embodiment of thepresent invention.

FIG. 1B illustrates an exemplary system architecture of amonitor-and-control system that includes a controller deployed on acomputer cluster accessible via a wide-area network in accordance withan embodiment of the present invention.

FIG. 2A presents a diagram illustrating an exemplary device architectureof an interfacing device in accordance with an embodiment of the presentinvention.

FIG. 2B presents a diagram illustrating an exemplary softwarearchitecture of an interfacing device in accordance with an embodimentof the present invention.

FIG. 2C presents a diagram illustrating an exemplary device architectureof an mPort interfacing device in accordance with an embodiment of thepresent invention.

FIG. 2D illustrates an mPort interfacing device in accordance with anembodiment of the present invention.

FIG. 2E presents a diagram illustrating an exemplary device architectureof an mPower interfacing device in accordance with an embodiment of thepresent invention.

FIG. 2F illustrates an mPower interfacing device in accordance with anembodiment of the present invention.

FIG. 2G presents a diagram illustrating an exemplary device architectureof an mDimmer or an mSwitch interfacing device in accordance with anembodiment of the present invention.

FIG. 2H illustrates an mDimmer interfacing device in accordance with anembodiment of the present invention.

FIG. 2I illustrates a plurality of mDimmer interfacing devices coupledvia a serial communication interface in accordance with an embodiment ofthe present invention.

FIG. 3A presents a flowchart illustrating an exemplary method forconfiguring a device controller in accordance with an embodiment of thepresent invention.

FIG. 3B presents a flowchart illustrating an exemplary method forpresenting configuration data and/or sensor data in accordance with anembodiment of the present invention.

FIG. 4A presents a flowchart illustrating an exemplary method forconfiguring a device-placement space for a space-view graphic userinterface (GUI) in accordance with an embodiment of the presentinvention.

FIG. 4B presents a flowchart illustrating an exemplary method fordisplaying and updating a space-view GUI in accordance with anembodiment of the present invention.

FIG. 4C presents a diagram illustrating an exemplary space-view GUI ofthe controller in accordance with an embodiment of the presentinvention.

FIG. 4D presents a diagram illustrating an exemplary space-view GUIprovided by the controller in accordance with an embodiment of thepresent invention.

FIG. 4E presents a diagram illustrating an exemplary space-view GUIprovided by the controller in accordance with an embodiment of thepresent invention.

FIG. 5A presents a flowchart illustrating an exemplary method forgenerating and storing rules for controlling a device in accordance withan embodiment of the present invention.

FIG. 5B presents a diagram illustrating an exemplary rule-view GUI ofthe controller in accordance with an embodiment of the presentinvention.

FIG. 5C presents a user interface illustrating exemplary pre-definedconditions that can be incorporated into a rule's condition set inaccordance with an embodiment of the present invention.

FIG. 6A presents a diagram illustrating an exemplary device-view GUI ofthe controller in accordance with an embodiment of the presentinvention.

FIG. 6B presents a diagram illustrating an exemplary data-view GUI ofthe controller in accordance with an embodiment of the presentinvention.

FIG. 6C presents a diagram illustrating an exemplary events-view GUI ofthe controller in accordance with an embodiment of the presentinvention.

FIG. 7 presents a flowchart illustrating an exemplary method forprocessing a rule at a local interfacing device in accordance with anembodiment of the present invention.

FIG. 8 illustrates an exemplary computer system for interfacing acontroller within a server cluster with devices within a LAN.

FIG. 9 presents a flowchart illustrating an exemplary method forestablishing a network connection to a remote device based onnetwork-addressing information received from a central controller forthe remote device in accordance with an embodiment of the presentinvention.

FIG. 10 presents a flowchart illustrating an exemplary method forestablishing a network connection with a remote device based on a storednetwork-addressing information for the remote device in accordance withan embodiment of the present invention.

FIG. 11 illustrates an exemplary system architecture that includes anmDimmer device in accordance with an embodiment of the presentinvention.

FIG. 12A illustrates an exemplary system architecture that includes acentral controller and one or more LAN controllers with mirroreddatabases in accordance with an embodiment of the present invention.

FIG. 12B illustrates an exemplary system architecture that includes aLAN controller within a local-area network and a forwarding serviceaccessible within a wide-area network in accordance with an embodimentof the present invention.

FIG. 13 illustrates an exemplary computer system for intelligentmonitoring and controlling of devices in accordance with one embodimentof the present invention.

FIG. 14A illustrates an angled view of an mPort interfacing device inaccordance with an embodiment of the present invention.

FIG. 14B illustrates a side view of an mPort interfacing device inaccordance with an embodiment of the present invention.

FIG. 14C illustrates a side view of an mPort interfacing device inaccordance with an embodiment of the present invention.

FIG. 15A illustrates an angled view of an mPort interfacing device inaccordance with an embodiment of the present invention.

FIG. 15B illustrates an angled view of an mPort interfacing device thatincludes an antenna connector in accordance with an embodiment of thepresent invention.

FIG. 15C illustrates a side view of an mPort interfacing device inaccordance with an embodiment of the present invention.

FIG. 15D illustrates a side view of an mPort interfacing device inaccordance with an embodiment of the present invention.

DETAILED DESCRIPTION

The following description is presented such that one of ordinary skilledin the art can make and use the embodiments, and is provided in thecontext of a particular application and its requirements. Variousmodifications to the disclosed embodiments will be readily apparent tothose skilled in the art, and the general principles defined herein maybe applied to other embodiments and applications without departing fromthe spirit and scope of the present disclosure. Thus, the presentinvention is not limited to the embodiments shown, but is to be accordedthe widest scope consistent with the principles and features disclosedherein.

Overview

Embodiments of the present invention provide a controller that can usevarious sensors and devices from various vendors to implement a unified“intelligent” environment, such as a “smart” home system or industrialenvironment. More specifically, these various physical devices arecoupled to one or more interfacing devices that continuously monitor andcontrol the physical devices, such that these interfacing devices can beaccessed and configured via the controller. For example, the centralizedcontroller can reside in a server cluster (e.g., the “cloud”), andallows a user to access a control UI via a Web browser or an applicationon the user's computer. Also, the interfacing device and physicaldevices can be distributed over a wide area (e.g., throughout a city, orat various cities across the globe). The user can interact with thecentralized controller to configure how the interfacing devices are tomonitor data from the physical devices in near real-time, and to controlhow the interfacing devices are to control one or more physical devicesbased on the monitored data.

Each interfacing device includes a plurality of device couplers and oneor more network interfaces, which enables the coupling between theinterfacing device and the centralized controller via a public orprivate network.

In one embodiment, the interfacing device is coupled to the controllervia an IP (Internet Protocol)-based network. Communication between theinterfacing devices and the centralized controller is realized byexchanging IP packets. The centralized controller can provide a graphicuser interface (GUI), which a user can use while the user is away at aremote location, to monitor and control how the devices are to operate.Moreover, the GUI enables the user to set up compound rules that governthe operations of the devices automatically.

The System Architecture

FIG. 1A illustrates an exemplary system architecture of amonitor-and-control system 100 in accordance with an embodiment of thepresent invention. Monitor-and-control system 100 includes a controller102, a network 106, a number of interfacing devices 108 (e.g.,interfacing devices 108.1 and 108.m), each coupled to a number ofphysical devices 110 under control. For example, interfacing device108.1 is coupled to physical devices 110.1, 110.2, and 110.n.

Controller 102 can include any computing device that communicates withinterfacing devices 108, and which executes a software application usedby a user 104 to monitor and control the operations of the physicaldevices coupled to interfacing devices 108. For example, controller 102can reside and run on a stand-alone computing device, including, but notlimited to a desktop or laptop computer 102.1, a personal digitalassistant (PDA) or smartphone 102.2, a tablet computer 102.3, and amainframe computer 102.k. In some embodiments, controller 102 residesand runs on a server cloud. Further, in some embodiments (not shown),controller 102 resides and runs on one or more interfacing devices(e.g., interfacing device 108.1 and/or 108.m) to implement a distributedcontroller.

Network 106 can generally include any type of wired or wirelesscommunication channel capable of coupling together computing nodes.Network 106 includes, but is not limited to a local area network, a widearea network, a private network, a public network, or a combination ofnetworks. In addition, network 106 can include a wired network, awireless network, or a combination thereof. In some embodiments, network106 includes an IP-based network. In a further embodiment, network 106includes the Internet.

Each interfacing device 108, such as interfacing device 108.1 or 108.m,includes a number of physical ports that enable coupling between theinterfacing device and a number of physical devices. Further, physicaldevices 110 (e.g., devices 110.1-110.n) can include any type of physicaldevice, such as a sensor, a machine, or any type of electricallyoperated component now known or later developed. The devices can includea sensor (e.g., a temperature sensor, a humidity sensor, a currentsensor, a motion sensor, and a door/window sensor), or a controllabledevice (e.g., a light switch, a power outlet, a power strip, a relay,etc.).

In some embodiments, physical devices 110 can be “dumb” devices that donot possess any intelligence, such as computational or networkingcapabilities. In a further embodiment, physical devices 110 can includeany type of off-the-shelf sensors that detect environment factors,including but not limited to a temperature, a sound, a light level, ahumility measurement, a motion, an electric current, an opening orclosing of a door/window, etc. The output of a sensor can include ananalog or a digital signal. For example, the output of a temperaturesensor may be an analog voltage signal within a certain range, and theoutput of a motion sensor may be a binary digital signal with “1”indicating that a motion has been detected.

In some embodiments, interfacing devices 108 can include a serial port(such as an RS232 or RS485 port), and a device 110 can be a serial-baseddevice that communicates with an interfacing device 108 via a serialport. For example, device 110.1 can include an appliance that can becontrolled via a serial port, and interfacing device 108.1 can becoupled to the appliance via a serial port. Thus, interfacing device108.1 can receive state information from the appliance via the serialport, and can communicate commands via the serial port to control theappliance. As another example, device 110.n can include a router, andinterfacing device 108.1 can be coupled to a console port of the router,thus enabling remote monitoring and controlling of the router.

FIG. 1B illustrates an exemplary system architecture of amonitor-and-control system 150 that includes a controller deployed on acomputer cluster 152 accessible via a wide-area network 154 inaccordance with an embodiment of the present invention. In someembodiments, computer cluster 152 can include a plurality of servercomputers 152.1-152.k, which use load-balancing to distribute loadsacross computer cluster 152.

Over time, a system administrator can add additional servers to computercluster 152 as the load across computer cluster 152 increases.Specifically, server computers 152.1-152.k can be distributed acrossvarious geographic locations, such that the number of servers for aspecific geographic location can be adjusted based on the demands ofthat geographic location. This allows computer cluster 152 to provideserve requests from and push data to a plurality of devices in nearreal-time.

During operation, computer cluster 152 can maintain a persistent orcontinuous network connection to a plurality of client devices (e.g., acomputing device 158, and/or interfacing devices 162). The networkconnection can include a bidirectional channel established using theWebSocket protocol, or a network connection that is maintained using theSTUN protocol, the Comet protocol, or any other communication protocolnow known or later developed. Computer cluster 152 can receive real-timedata from these client devices, and can forward a piece of real-timedata to a client device that has subscribed to the piece of data. Forexample, in some embodiments, computer cluster 152 can include adatabase 166 associated with the controller, such that database 166 canmaintain a list of “tailable cursors.” These tailable cursors implementa queue for forwarding data to the client devices that have subscribedto a piece of data. The client devices can bind on, and wait on, thesetailable cursors.

In some embodiments, device 158 can include a client computing device,such as a computer (e.g., a laptop), a mobile device (e.g., a smartphoneor tablet), etc. Device 158 can communicate with computer cluster 152and/or interfacing devices 162 by establishing and maintaining a networkconnection to the desired target device. For example, a user 156 can usean application running on device 158 (e.g., a laptop or a smartphone) toestablish a session with a controller running on computer cluster 152,and receives network-addressing information for one or more interfacingdevices 162 from the controller. Device 158 can then use aninterfacing-device's network-addressing information to send data to theinterfacing device, and/or to establish a network connection with theinterfacing device.

In some embodiments, device 158 and/or interfacing device 162 candetermine when they can communicate with each other peer-to-peer, andwhen they need to communicate with each other via a forwarding service(e.g., via computer cluster 152). For example, device 158 can remember aconfiguration snapshot for the distributed interfacing-device network bystoring the device-accessing information for interfacing devices 158and/or any other computing devices. This device-accessing informationcan include network-addressing information such as an IP address andport number for the remote device, and/or can include authenticationinformation for accessing the remote device (e.g., a digitalcertificate, a username, a password, an authorization token, etc.).Thus, if interfacing devices 162 within LAN 160 lose their connection tothe controller (e.g., LAN 160 becomes decoupled from WAN 154), theapplication on device 158 can use the stored configuration snapshot tocommunicate directly with interfacing devices 162 via LAN 160. Thisallows a software application that monitor the interfacing-devicenetwork to communicate directly with the interfacing devices 162,without first contacting a controller on computer cluster 152.

In some embodiments, device 158 can test a connection to an interfacingdevice by sending a request to the interfacing device using the knownnetwork-addressing information (e.g., via a JSONP message). The requestcan indicate device-identifying information for the desired interfacingdevice (e.g., a logical identifier, a MAC address, etc.), which allowsdevice 158 to test the connection without requesting sensitiveinformation from the remote device. If the request reaches aninterfacing device, the interfacing device compares thisdevice-identifying information with its local device-identifyinginformation, and acknowledges its identity if it is indeed the targetinterfacing device. In some embodiments, the interfacing deviceacknowledges its identity to device 158 by providing authenticationinformation, such as a digital certificate.

If the network-addressing information includes an IP address for theinterfacing device, device 158 can use this IP address to communicatewith the interfacing device while coupled to the same local-area networkas the interfacing device (e.g., LAN 160). However, if device 158 is notcoupled to the same LAN as the interfacing device and cannot establish apeer-to-peer connection across domains (e.g., due to a firewall), device158 can communicate with the interfacing device using a data-forwardingservice (e.g., computer cluster 152, or another server computer coupledto WAN 154).

Additionally, in some embodiments, device 158 can auto-discover thepresence of other devices (e.g., using universal plug-and-play (UPnP),or other auto-discovery protocols). For example, if aninterfacing-device's network information has changed, and device 158cannot establish a network connection to the central controller, device158 can auto-discover the presence of other devices to obtaindevice-identifying information (e.g., a MAC address, a digitalcertificate, etc.). Device 158 can compare received device-identifyinginformation of the discovered devices to that of a set of desiredinterfacing devices. If an auto-discovered device matches a desiredinterfacing device, device 158 can obtain and store network-addressinginformation for the discovered device (e.g., to replace old or invalidinformation), and can use this network-addressing information establisha network connection to the discovered device.

User 156 can interact with the central controller using an Internet webbrowser on device 158 (e.g., to access the controller hosted by computercluster 152), which allows the user to browse real-time data fromvarious interfacing devices 162. The controller can generate a web pagefor the user that includes the network-addressing information for thevarious interfacing devices. If device 158 is within the same domain asan interfacing device (e.g., a local-area network, or a virtual privatenetwork), the web browser on device 158 can obtain the real-time datadirectly from the interfacing device. For example, the web browser canuse JSONP (JavaScript object notation, with padding) or CORS(cross-origin resource sharing) to request data from the interfacingdevice that may reside on a different domain as the controller thathosts the web page.

In some embodiments, the devices within system architecture 150 cancommunicate with each other in near real-time by establishing andmaintaining a persistent or continuous network connection. For example,interfacing devices 162 can subscribe to data from each other, and canpush real-time data to the subscribing devices using the networkconnection. As another example, device 158 can establish a networkconnection to a plurality of interfacing devices 162, and receivesreal-time data to present to the user.

Further, a local device within LAN 160 can establish and maintain apersistent network connection with computer cluster 152 by determiningits external address and sharing this address with computer cluster 152(e.g., using STUN), or by maintaining a port tunnel through a firewallwithin LAN 160 (e.g., using Comet). Alternatively, the local device canalso establish a persistent bidirectional network connection, such asusing the Web Socket protocol or any other bidirectional communicationprotocol.

To maintain the network connection using Comet, the local device cansend long-polling requests to computer cluster 152 (e.g., as anXMLHttpRequest (XHR) message), which opens a temporary port within thefirewall through which computer cluster 152 can use to provide aresponse message. If computer cluster 152 has new data to provide to thelocal device, computer cluster 152 can respond to the XHR message usingan XHR response that includes the new data. Otherwise, if computercluster 152 does not have new data for the local device, computercluster 152 does not respond to the XHR request, thus allowing the XHRrequest to expire.

Once an XHR request expires, a network router or firewall may close aport associated with the XHR request, which prevents computer cluster152 from providing new data to the local device. Thus, to maintain anetwork connection with computer cluster 152, the local device canperiodically send additional long-polling requests before the existingrequest times-out (e.g., at 30 second intervals). Computer cluster 152can associate the recent XHR request with the local device (e.g.,replacing the previous XHR request), and uses network-addressinginformation from the recent XHR request to push real-time data to thelocal device.

To establish a network connection using the WebSocket protocol, thelocal device can send to computer cluster 152 a WebSocket handshakerequest, which upgrades an HTTP session to a WebSocket session andincludes a Sec-WebSocket-Key token for the controller on computercluster 152. The controller responds by sending to the local device aresponse that acknowledges the WebSocket session, and includes aSec-WebSocket-Accept token that is derived from the Sec-WebSocket-Keytoken.

The Device Architecture

FIG. 2A presents a diagram illustrating an exemplary device architectureof an interfacing device 200 in accordance with an embodiment of thepresent invention. Interfacing device 200 includes a number of physicalports, such as ports 202, 204, and 206, for providing physicalconnectivity to a number of physical devices; a processing unit 208, astorage unit 210, a packet generator/parser 212 for generating orparsing communication packets, a wired network interface 214, and awireless network interface 216. Interfacing device 200 may optionallyinclude a universal serial bus (USB) port 218.

Physical ports 202-206 provide coupling between interfacing device 200and a number of physical devices. More particularly, physical ports206-208 can provide power to, receive input signals from, and sendoutput signals to the coupled physical devices. In some embodiments,these functions are realized by wired connections between a physicalport and a physical device. For example, a typical temperature sensormay include three pins, one for ground, one for power input, and one foranalog voltage output. When the temperature sensor is coupled to aphysical port, each of the three pins are wired to correspondingconnecting point inside the physical port, thus enabling interfacingdevice 200 to provide power to and receive output voltages from thetemperature sensor via those wired connections. In some embodiments, thephysical ports include at least an RJ45 port (which is an RJ45 femalejack) that provides eight equally spaced conducting channels. An RJ45cable plugged into the jack provides wired connections to a device,which may or may not include an RJ45 jack. In some embodiments, thephysical ports include a terminal-block port, which includes eightequally spaced metal posts each can be wired to a device terminal. Notethat this simple terminal-block port enables coupling betweeninterfacing device 200 and almost any type of device as long as thedevice has equal or less than eight connections.

Processing unit 208 is responsible for sampling, analyzing, andinterpreting raw input signals (either analog or digital) received fromthe physical devices. For example, if a coupled physical device is atemperature sensor, raw input signals received by the correspondingphysical port will be analog voltages within a certain range (such asfrom 0 to 2 Volts), and processing unit 208 can convert the analogvoltages to corresponding temperatures using calibration informationassociated with the temperature sensor. In some embodiments, calibrationinformation associated with a sensor can be provided by the user. Insome embodiments, the monitor-and-control system maintains a record ofmany off-the-shelf sensors, and can perform a lookup for the calibrationinformation based on the make and model of a sensor. In addition,processing unit 208 is also responsible for executing control commandsreceived from the controller. For example, if the controller sends acommand for turning off a temperature sensor, processing unit 208 willstop providing power to corresponding terminals.

Storage unit 210 is responsible for storing various types ofinformation, such as historical data, associated with the coupleddevices. Packet generator/parser 212 generates communication packetsusing information obtained from processing unit 208 and storage unit210, and parses communicate packets received from the controller. Insome embodiments, packet generator/parser 212 is capable of generatingand parsing IP packets.

Wired network interface 214 and wireless network interface 216 providecoupling between interfacing device 200 and a network, thus couplingbetween interfacing device 200 and the controller. In some embodiments,wired network interface 214 and wireless network interface 216 allowinterfacing device 200 to be coupled to the Internet. In someembodiments, wired network interface 214 includes an Ethernet port. In afurther embodiment, the Ethernet port also provides power to interfacingdevice 200 via Power over Ethernet (PoE). In addition to providing acommunication interface to the controller, wired network interface 214and wireless network interface 216 also enable interfacing device 200 tocommunicate with other peer interfacing devices.

In some embodiments, if interfacing device 200 has not been configured,interfacing device 200 can configure wireless network interface 216 tofunction as an access point. The user can use a personal computingdevice to gain access to the access point by connecting to a wirelessLAN associated with interfacing device 200 (e.g., the user can determinean SSID and passcode for the wireless LAN, for example, from printedtext on the chassis of interfacing device 200). Once the user'scomputing device is connected to the access point, interfacing device200 can provide a configuration GUI to the user, for example, via anHTTP (hypertext transfer protocol) session.

When the user launches a web browser on his personal computer,interfacing device 200 can redirect the user's web browser to theconfiguration GUI that allows the user to configure the access point asdesired. For example, the user can configure a connection to the user'spersonal access point (e.g., a wireless router connected to theInternet), and can enter his personal login information for a servicethat allows the user to control interfacing device 200 via the Internet.

Once the user has finished configuring interfacing device 200,interfacing device 200 proceeds to save the configuration and rebootsitself. While interfacing device 200 is rebooting, if interfacing device200 determines that it has been configured properly, interfacing device200 can configure wireless network interface 216 to function as awireless client device, and connects to the user's personal wirelessaccess point.

In some embodiments, an interfacing device can also be a speciallydesigned, web-enabled power strip that can monitor the energy usage(such as current and/or voltage) of a device coupled to the power strip.This power strip device can control a coupled device, for example, byturning on or off a corresponding power socket locally or remotely.

FIG. 2B presents a diagram illustrating an exemplary softwarearchitecture 220 of an interfacing device in accordance with anembodiment of the present invention. Software architecture 220 caninclude an operating system kernel 222, device drivers 224,communication modules 228, a webserver 234, and a micro-controller agentmodule (mcAgent 226). Specifically, interfacing device 200 can storesoftware architecture 220 within storage unit 210 and can execute one ormore modules of software architecture 220 using processing unit 208.

Communication modules 228 can include an internet-protocol (IP) module230 for establishing and maintaining a network connection with a remotedevice based on an IP-level protocol, such as using the STUN protocol,the Comet protocol, etc. In some embodiments, communication modules 228can include can include a WebSocket module 232 for establishing andmaintaining a network connection with a remote device based on theWebSocket protocol. WebSocket module 232 can include a user-spaceapplication or service that utilizes other kernel-space services (e.g.,device drivers 224) and/or other user-space services to establish andmaintain the network connection.

OS kernel 222 can include any operating system, such as a variant of theLinux operating system. Microcontroller agent (mcAgent) 226 can includea user-space application that runs on OS kernel 222 to realize thefunctionality of interfacing device 200 as described herein. Forexample, mcAgent can interact with device drivers 224 to detecting auser-driven event (e.g., from a user-input device, such as a lightswitch), for periodically monitoring a sensor input (e.g., a motionsensor), and/or for controlling an output device (e.g., a power supply).Also, mcAgent can interact with communication modules 228 to establish anetwork connection to a remote controller and/or to one or more remoteinterfacing devices, and/or for sending or receiving data to/from thecontroller or a remote interfacing device via the corresponding networkconnection.

Device drivers 224 can include one or more kernel-space driver modulesaccessible via a virtual file interface (e.g., a virtual file under the“/proc” directory of the Linux file system). Communication modules 228and/or mcAgent 226 can interact with device drivers 224 by reading fromand/or writing to a virtual file that corresponds to a target device.

Device drivers 224 can include, for example, a network-device driver foraccessing and controlling a network interface, such as an Ethernetcontroller, a Wi-Fi controller, or a Bluetooth controller. OS kernel 222may access the network-device driver to communicate with a remotecomputing device. Also, communication modules 228 may access thenetwork-device driver to establish and maintain a network connectionwith a controller and/or to a peer interfacing device.

As another example, device drivers 224 can include driver modules formonitoring or controlling a peripheral device via a general-purposeinput-output (GPIO) port of the processing unit, via a serial interfaceof the processing unit, or via a universal asynchronousreceiver/transmitter (UART) port of the processing unit. The serialinterface, for example, can include a serial peripheral interface (SPI)bus, an inter-integrated circuit (I²C) bus, or any serial interface nowknown or later developed.

In some embodiments, the peripheral device can include a volatilestorage device (e.g., a random-access memory (RAM) module), or anon-volatile storage device (e.g., a flash memory device). In some otherembodiments, the peripheral device can include a shift register, ananalog-to-digital converter (ADC), a digital-to-analog converter (DAC),a power-output regulator, a relay, a triode for alternating current(TRIAC)-based device, etc. Further, the peripheral device can alsoinclude a user-input device, such as a touch-sensitive user interface.

MicroController Agent

In some embodiments, microcontroller agent (mcAgent) 226 manages theperformed by an interfacing device, such as to manage data subscriptionsfrom a plurality of remote devices, and to process rules that aretriggered when new events are detected. During operation, mcAgent 226can receive a data-subscription request from a remote device (e.g., acontroller or an interfacing device), at which point mcAgent 226 caninsert the data-subscription request into a repository of datasubscriptions. The data-subscription request can indicate a type of databeing subscribed to, and a condition (e.g., a minimum or maximumthreshold value) that needs to be satisfied for mcAgent 226 to push thedata to the remote device.

Also, mcAgent 226 can periodically sample data from various inputsensors, and can push data to a remote device that has subscribed to acertain type of data updates. mcAgent 226 can sample data from an inputsensor or device periodically at a predetermined interval (e.g., every15 milliseconds). Each time mcAgent 226 obtains a data sample, mcAgent226 can compare the sampled value (or a change in value from the lastsampled value) to one or more threshold values associated with a set ofdata subscriptions. If the sampled data value (or the change in value)satisfies a subscription request, mcAgent determines a remote deviceassociated with the data subscription, and pushes the sampled data valueto the remote device. In some embodiments, the system can push thesampled data value to the remote device, for example, usingnetwork-addressing information associated with a persistent networkconnection to the remote device (e.g., using WebSocket module 232).

In some embodiments, the remote device an interfacing device that usesthe sampled data to determine whether to perform a rule's action.

In some other embodiments, the remote device can include a controllerthat gathers and/or presents data to a user. For example, a user canconfigure the controller to store an event log for events that satisfycertain conditions at interfacing device 200. The controller canestablish and maintain a network connection with interfacing device 200,and populates the event log by subscribing to sampled data frominterfacing device 200, under the conditions specified by the user.

As another example, the user can use a personal computing device tomonitor data from various interfacing devices via the controller. Theuser accesses a “map” user interface (UI) from the controller, such thatthe map UI illustrates sensors associated with interfacing device 200 ona map, and can also illustrate the sampled real-time data on the map.Thus, to display the real-time data to the user, the controller canestablish and maintain a persistent network connection to interfacingdevice 200, and subscribes to data sampled by interfacing device 200.The subscription can indicate that the sampled data is to be pushed tothe controller periodically at a predetermined time interval (e.g.,every second), or when the sampled data changes in value by at least athreshold amount. This way, while the user is browsing the map UI, thecontroller can receive and display the sensor data to the user in nearreal-time. When the user navigates away from the sensor on the map UI,or when the user closes the map UI, the controller can send a request tointerfacing device 200 to cancel the data subscription. The controllercan also terminate the network connection to interfacing device 200 ifcontroller does not need to send or receive data to/from interfacingdevice 200.

Exemplary Interfacing Devices

FIG. 2C presents a diagram illustrating an exemplary device architecture240 of an mPort interfacing device in accordance with an embodiment ofthe present invention. Device architecture 240 can include a flashstorage device 246 that stores data and software instructions foroperating the mPort interfacing device, as well as a processing unit 242and a memory device 244 for executing the instructions.

Device architecture 240 can include digital inputs 252, and digitaloutputs 254. Digital inputs 252 can be coupled to digital output signalsof one or more external devices, such as a door sensor, a toggle switch,etc. Digital outputs 254 can be coupled to an external device toconfigure or control the external device, or can be coupled to an outputdisplay of the mPort device (e.g., a liquid-crystal display (LCD), orlight-emitting diode (LED) indicators).

Device architecture 240 can also include at least one analog-to-digitalconverter (ADC) 255, which converts an analog signal's physical quantityinto a digital signal (e.g., a binary number) that represents thephysical quantity's amplitude. In some embodiments, ADC can be coupledto an external device via analog inputs 256, such as a sensor, to samplea physical quantity associated with the sensor. Analog inputs 256 caninclude a differential pair from which ADC 255 samples a correspondinganalog signal. Processing unit 242 can read data from ADC 255 viadigital interface pins or via a serial bus, and stores or operates onthe data that represents a physical quantity associated with theattached sensor.

For example, in some embodiments, analog inputs 256 can be coupled to adifferential pair from a temperature sensor (not shown). The temperaturesensor can provide a continuous analog signal over the differentialpair, such that the analog signal represents a physical temperaturequantity detected by a sensing portion of the temperature sensor.Further, processing unit 242 can interface with the sensor via digitaloutputs 254, for example, to calibrate the sensor, or to configure thesensor's operation (e.g., to configure a sensing period).

Device architecture 240 can include one or more modules forcommunicating with external devices. For example, device architecture240 can include communication modules 247, which can include an Ethernetmodule coupled to an Ethernet port 249, and/or can include or be coupledto a wireless module 248 (e.g., a Wi-Fi module, or a Bluetooth module).Device architecture 240 can also include a serial port 250 (e.g., anRS-232 jack for a UART port), which can be coupled to an externalperipheral device, and can be used by processing unit 242 to monitorand/or control the peripheral device. The peripheral device can includean appliance (e.g., an HVAC system), or any electronic or computingdevice that can communicate via UART port 250.

FIG. 2D illustrates an mPort interfacing device 258 in accordance withan embodiment of the present invention. Specifically, the chassis fordevice 258 includes access to at least a reset switch, an Ethernet port,a universal serial bus (USB) port, an Ethernet port, a serial port, anda set of connections to one or more external physical devices (e.g., viaan RJ-45 port, or via connection terminals). Device 258 can also includewireless networking devices, such as an internal Wi-Fi module.

Also, mPort interfacing device 258 can include a set of LED indicators.A power LED indicator becomes steady green when mPort interfacing device258 is properly connected to a power source. An Ethernet LED indicatorlights steady green when an active Ethernet connection is made, andflashes when the Ethernet connection has activity. A status LED lightsyellow when mPort interfacing device 258 is first powered on in factorydefault mode out of the box, and lights steady green when device 258 hasbeen successfully integrated into a network and is working properly.Also, the status LED flashes when the Locate button is used in the mFiController software to display device 258 on a map.

FIG. 14A illustrates an angled view of an mPort interfacing device 1400in accordance with an embodiment of the present invention.

Specifically, the device 1400 includes a set of connections to one ormore external physical devices (e.g., via an RJ-45 port 1402, or viaconnection terminals 1404), includes a reset button 1410, and includesLED indicators 1412. Device 1400 can also include a universal serial bus(USB) connector 1406 and an Ethernet port 1408, which facilitatesconnecting device 1400 to a computer network or to another device (e.g.,a personal computer for configuring device 1400).

FIG. 14B illustrates a side view of an mPort interfacing device 1430 inaccordance with an embodiment of the present invention. Specifically,the side view of device 1430 illustrates a set of LED indicators, andillustrates two RJ-45 ports and a set of connection terminals, which canbe coupled to one or more external physical devices.

FIG. 14C illustrates a side view of an mPort interfacing device 1460 inaccordance with an embodiment of the present invention. Specifically,the side view of device 1430 illustrates a USB port, an Ethernet port,and a reset button.

FIG. 15A illustrates an angled view of an mPort interfacing device 1500in accordance with an embodiment of the present invention. Specifically,the device 1500 includes a serial connector 1502 (e.g., an RS-232 port,RS-422 port, and/or RS-485 port) that can be coupled to a peripheraldevice (e.g., an appliance), and includes connection terminals 1504 thatcan be coupled to a physical device (e.g., a sensor). Device 1500 alsoincludes a reset button 1510, and LED indicators 1512. Device 1500 canalso include a universal serial bus (USB) connector 1506 and an Ethernetport 1508, which facilitates connecting device 1500 to a computernetwork or to another device (e.g., a personal computer for configuringdevice 1500).

FIG. 15B illustrates an angled view of an mPort interfacing device 1520that includes an antenna connector 1522 in accordance with an embodimentof the present invention. Specifically, antenna connector 1522 caninclude a male coaxial connector, which can be coupled to an antenna foruse by a wireless module, such as a Wi-Fi module (e.g., wireless module248 of FIG. 2C).

FIG. 15C illustrates a side view of an mPort interfacing device 1540 inaccordance with an embodiment of the present invention. Specifically,the side view of device 1540 illustrates a set of LED indicators, anantenna connector, as well as a a serial connector and a set ofconnection terminals that can be coupled to one or more externalphysical devices.

FIG. 15D illustrates a side view of an mPort interfacing device 1560 inaccordance with an embodiment of the present invention. Specifically,the side view of device 1560 illustrates a USB port, an Ethernet port,and a reset button.

FIG. 2E presents a diagram illustrating an exemplary device architecture260 of an mPower interfacing device in accordance with an embodiment ofthe present invention. Device architecture 260 can include a flashstorage device 266 that stores data and software instructions foroperating the mPower interfacing device, as well as a processing unit262 and a memory device 264 for executing the instructions.

Device architecture 260 can include one or more power-output modules270, and each power-output module 270 can include a power-outputcontroller 274 (e.g., a Prolific PL7221 integrated circuit (IC) device),a relay 272, and a power outlet 276. Processing unit 262 can enable ordisable power transmitted via power outlet 276 by controlling thecorresponding power-output controller 274 via digital interface pins orvia a serial bus, at which point power-output controller 274 cangenerate an electrical signal for opening or closing relay 272 to enableor disable the power transmission to power outlet 276. Processing unit262 can also configure power-output controller 274 to monitor an amountof power dissipated by power outlet 276, for example, to periodicallyobtain a power measurement for a corresponding electrical load.

Processing unit 262 can configure power-output controller 274 to samplephysical quantities of the power signal on power outlet 276, and canobtain the sampled value via the digital interface pins or the serialbus. The sampled physical quantities can include an electric current, anelectric voltage, a real power, a reactive power, an apparent power,and/or other physical quantities of a power signal.

In some embodiments, device architecture 260 can include acurrent-regulating device (e.g., a TRIAC device, not shown) to controlan amount of power that is provided to an external device. Power-outputcontroller 274 can provide a trigger pulse to the current-regulatingdevice for a determinable time interval, when the power signal's phasereaches a certain phase angle, to provide a desired power level to theexternal device. When power outlet 276 is coupled to a light fixture,for example, power-output controller 274 can control thecurrent-regulating device as a means to adjust the light fixture'sbrightness level. As another example, when power outlet 276 is coupledto an induction motor (e.g., a ventilation fan), power-output controller274 can control the current-regulating device as a means to adjust therotational speed of the motor's shaft (e.g., the fan's blades).

Device architecture 260 can also include a serial port 267, which can becoupled to an external peripheral device that receives power from poweroutlet 276. For example, processing unit 262 can use serial port 267 toconfigure the peripheral device after powering up the peripheral devicevia power outlet 276 (e.g., a computing device), and/or to monitor andcontrol the peripheral device while the device is operational. In someembodiments, if the device fails to respond to commands via serial port267, processing unit 262 can determine that the peripheral device hasexperienced a failure event, and can re-set the device by performing apower cycling operation via power outlet 276. If processing unit 262needs to disable power to the peripheral device while the peripheraldevice is operational, processing unit 262 can use serial port 267 toperform a shut-down sequence on the peripheral device.

Device architecture 260 can also include one or more modules forcommunicating with external devices. For example, device architecture260 can include communication modules 268, which can include an Ethernetmodule coupled to an Ethernet port 269, and/or can include or be coupledto a wireless module 265 (e.g., a Wi-Fi module, or a Bluetooth module).

FIG. 2F illustrates an mPower interfacing device 278 in accordance withan embodiment of the present invention. Specifically, device 278includes at least a reset button, a status LED indicator, one or morepower outlets, and a power plug. The status LED indicator lights yellowwhen device 278 is first powered on in factory default mode out of thebox, and lights steady green when device 278 has been successfullyintegrated into a network and is working properly. Also, the status LEDflashes when the Locate button is used in the mFi Controller software todisplay device 278 on a map.

FIG. 2G presents a diagram illustrating an exemplary device architecture280 of an mDimmer or an mSwitch interfacing device in accordance with anembodiment of the present invention. Device architecture 280 can includea flash storage device 284 that stores data and software instructionsfor operating the mDimmer interfacing device, as well as a processingunit 282 and a memory device 283 for executing the instructions. Devicearchitecture 260 can also include a touch-sensitive user-interface 294and a microcontroller 288 for controlling touch-sensitive user-interface294. Touch-sensitive user-interface 294 can include a proximity sensor295, a motion sensor 296, and a plurality of touch-sensitive sensors297.

Proximity sensor 295 can detect when an object (e.g., a user's hand) iswithin a close proximity of touch-sensitive user-interface 294, andgenerates an analog signal based on the proximity of the detected objectto proximity sensor 295. For example, proximity sensor 295 can includean infrared proximity sensor, which emits an infrared signal from aninfrared emitter, and generates the analog signal based on an amount ofinfrared light detected by an infrared detector (e.g., infrared lightthat reflected off the user's hand).

Touch-sensitive sensors 297 can include resistive-touch sensors,capacitive-touch sensors, or any touch-screen sensors now known or laterdeveloped. When a user touches a respective touch-sensitive sensor(e.g., sensor 297.n), the touch-sensitive sensor detects an increase incapacitance on the surface of its touch screen, and generates an analogvoltage which reflects the amount of capacitance that was detected.

A respective touch-sensitive sensor can include a jagged shape along onedimension, such as a plurality of chevron shapes adjoined along ahorizontal dimension, and the set of touch-sensitive sensors 297.1-297.ncan be arranged along a dimension of user-interface 294 perpendicular tothe jagged shape (e.g., along a vertical dimension of user-interface294). Further, two neighboring touch-sensitive sensors can be placed inclose proximity, for example, so that a lowest point on onetouch-sensitive sensor (e.g., sensor 297.1) has a vertical coordinatealong user-interface 294 that is less than or equal to a highest pointon a lower-neighboring touch-sensitive sensor (e.g., sensor 297.2).

Alternatively, a respective touch-sensitive sensor can include any othershape suitable for implementing a touch-sensitive grid, and the set oftouch-sensitive sensors 297.1-297.n can be arranged along two dimensionof user-interface 294 to create a touch-sensitive surface (e.g., a gridor any other user-interface pattern) associated with a pre-determinedset of touch-surface gestures.

Regarding motion sensor 296, motion sensor 296 can include an ultrasonicmotion sensor, a microwave motion sensor, a tomographic motion sensor,or any motion sensor now known or later developed. When a user or anobject moves in front of touch-sensitive user-interface 294, motionsensor 296 can detect the motion and can generate a binary value thatindicates that an object has been detected. In some embodiments, motionsensor 296 can generate an analog or digital value that indicates, forexample, a change in an ultrasonic measurement, a change in a microwavemeasurement, etc.

Touch-sensitive user-interface 294 generates a digital output signal foreach of proximity sensor 295, touch-sensitive sensors 297.1-297.n, andmotion sensor 296. In some embodiments, touch-sensitive user-interface294 can include an ADC device for each sensor, which converts thesensor's analog signal value to a digital binary signal. Touch-sensitiveuser-interface 294 can provide the digital binary signal tomicrocontroller 288 via a parallel bus (e.g., a plurality of GPIO pinson microcontroller 288), or via a serial bus (e.g., an SPI or an I²C buson microcontroller 288).

In some other embodiments, touch-sensitive user-interface 294 caninclude a Schmitt trigger device for each sensor, and a respectiveSchmitt trigger generates a binary output signal which indicates whethera corresponding sensor has detected an object. Touch-sensitiveuser-interface 294 can transmit the binary values for the varioussensors to microcontroller 288 via a parallel bus (e.g., a plurality ofGPIO pins on microcontroller 288, one pin per sensor), or via a serialbus (e.g., an SPI or an I²C bus on microcontroller 288).

Microcontroller 288 can periodically monitor the state for the varioussensors of touch-sensitive user-interface 294, for example, atapproximately 15 millisecond intervals. If microcontroller 288determines that proximity sensor 295 detects an object, microcontroller288 can activate a light source for touch-sensitive user-interface 294to allow the user to see user-interface 294 while the user is entering adevice-controlling command via user-interface 294. Microcontroller 288can activate the light source, for example, by ramping up the brightnessof the light source over a determinable time interval to a determinablelevel (e.g., to a fixed level, or to a level derived from an amount ofambient light).

Also, if microcontroller 288 determines that a touch-sensitive sensorhas detected an object's touch, microcontroller 288 can determine agesture based on the current state and the previous state oftouch-screen user-interface 294. For example, microcontroller 288 candetermine a current region of user-interface 294 that the user istouching (e.g., the current state), and can determine a direction for agesture based on a previous touch-sensitive sensor that detected anobject's touch (e.g., the previous state). Once the user has completedhis interaction with user-interface 294, microcontroller 288 cangenerate a gesture that indicates a speed and a direction of the user'sgesture, and/or a distance traveled by the user's gesture. Thus,microcontroller 288 may determine that the user is making an upwardfinger-swipe gesture or a downward finger-swipe gesture, as well as aspeed and distance traveled by the finger-swipe gesture.

If the user is not swiping his finger across the surface oftouch-sensitive user-interface 294 (e.g., the previous state did notinvolve the user touching or swiping across user-interface 288),microcontroller 288 can determine a region of user-interface 294 thatthe user has touched. Microcontroller 288 can generate and store agesture that indicates the surface portion of user-interface 294 thatthe user has touched, for example, using a numeric value that indicatesa vertical coordinate of the user-interface 294 touched by the user.Processing unit 282 can configure the power output to the light fixtureto reach a light intensity that corresponds to the numeric value.

In some embodiments, processing unit 282 periodically polls the sensorreadings (e.g., at approximately 15 millisecond intervals) and/ordetected gestures from microcontroller 288. Also, processing unit 282can use the obtained data to select a set of rules to evaluate, and canperform an action associated with any rules whose conditions have beenmet. Processing unit 282 can also select a set of remote devices thathave subscribed to a piece of data (e.g., data for a detected motionand/or a detected gesture), and can send the piece of data to theselected devices using network addressing information associated withtheir corresponding network connections.

Device architecture 280 can include one or more communication modules285 for communicating with external devices. Communication modules 285can include or be coupled to a wireless module 286 (e.g., a Wi-Fimodule, or a Bluetooth module), and/or can include an Ethernet modulecoupled to an Ethernet port (not shown). Device architecture 280 canalso include a serial port 287 (e.g., an RS-232 jack for a UART port),which can be coupled to an external peripheral device, and can be usedby processing unit 282 to monitor and/or control the peripheral device.The peripheral device can include an appliance (e.g., an HVAC system),or any electronic or computing device that can communicate via serialport 287.

Device architecture 280 can also include power-controlling modules 290to control and/or regulate an output power signal, and can include apower-output controller 289 to configure and monitor the power output bypower-controlling modules 290. Device architecture 280 can also includepower terminals 292 for providing the output power signal to anelectrical load, such as a light fixture, an electric motor, an HVACsystem, etc. In some embodiments, device architecture 280 implements alight switch (e.g., an mSwitch device), and power-controlling modules290 includes a relay 290.1. When processing unit 282 determines that theuser has touched a surface of touch-sensitive user-interface 294 (e.g.,touched any of touch-sensitive sensors 297), processing unit 282 canconfigure microcontroller 288 to open relay 290.1 if it is closed, or toclose relay 290.1 if it is open. This configuration enables the user toturn on or turn off a light fixture electrically coupled to powerterminals 292. Microcontroller 288 opens or closes relay 290.1 byconfiguring power-output controller 289 to generate the electricalsignals necessary for opening or closing relay 290.1. Microcontrollercan also configure power-output controller 289 to monitor an amount ofpower dissipated by power-terminals 292, for example, to periodicallyobtain a power measurement for an electrical load.

In some embodiments, device architecture 280 implements a light dimmer(e.g., an mDimmer device), and power-controlling modules 290 includes aTRIAC 290.2. When processing unit 282 detects a touch-screen gesturefrom a user (e.g., via microcontroller 288), processing unit 282 canconfigure microcontroller 288 to adjust a brightness level for a lightfixture electrically coupled to power terminals 292. For example, as theuser performs an upward finger swipe on touch-sensitive user-interface294, processing unit 282 can determine a brightness level for the lightfixture based on the current (or most recent) position, direction,and/or velocity of the user's finger on touch-sensitive user-interface294. Processing unit 282 can select the highest brightness level if theuser taps on touch-sensitive sensor 297.1, or can select the lowest (oroff) brightness level if the user taps on touch-sensitive sensor 297.n.Processing unit 282 can configure microcontroller 288 to adjust thepower output transmitted by triac 290.2 to correspond to the user'sdesired brightness level. Microcontroller 288 controls the power outputby configuring power-output controller 289 to generate the electricalsignals necessary for configuring triac 290.2 to reach and maintain thepower output at the desired level.

In some embodiments, power-output controller 289 also monitors an amountof current, an amount of power, and/or a phase of the power beingtransmitted via power terminals 292. Microcontroller 288 can calibratepower output controller 289, based on the measured values, to stabilizethe power transmitted via power terminals 292. If microcontroller 288detects a change in the electrical load, for example due to a dimminglight fixture, microcontroller 288 can adjust power output controller289 to compensate for the change in the electrical load to reach adesired power output. Thus, microcontroller 288 can use power outputcontroller 289 to implement a feedback loop that adjusts power to alight fixture to ensure a steady (non-fluctuating) light intensity, evenas the light fixture ages over time.

In some embodiments, processing unit 282 can store a previous lightinglevel for the user. For example, the user can perform a finger-swipegesture to adjust the lighting level to a desired level (e.g., byswiping his finger to a position associated with the desired lightinglevel). Then, to turn off the light, the user can tap anywhere ontouch-sensitive user-interface 294, at which point processing unit 282stores the current lighting level for the user, and configurespower-output controller 289 to disable power to power terminals 292. Ifa user taps anywhere on touch-sensitive user-interface 294 at a latertime to turn on the lights, processing unit 282 can restore power to thelight fixtures to the previous lighting level based on the storedsettings.

Further, processing unit 282 can quickly ramp up or ramp down thebrightness level if the user performs a fast upward or downward fingerswipe. Alternatively, processing unit 282 can perform fine-grainedadjustments to the light fixture's brightness level if the user performsa slow upward or downward finger swipe, for example, to increase ordecrease the brightness level by a finer granularity than can beachieved by tapping on any of touch-sensitive sensors 297.

In some embodiments, processing unit 282 can control a light fixturethat is not electrically coupled to power terminals 292. When processingunit 282 detects a gesture event performed by the user (e.g., viamicrocontroller 288), processing unit 282 can send the gesture event toa remote interfacing device that has subscribed to events from the localinterfacing device. The remote interfacing device can include a devicethat provides power to a light fixture, such as an mPower deviceillustrated in FIG. 2E. When the remote interfacing device receives thegesture event, the remote interfacing device can use the eventinformation to control power to a light fixture based on a rule storedin the device's local rule repository.

In some embodiments, the electrical load coupled to power terminals 292can include an HVAC system. For example, processing unit 282 can beconfigured to control an HVAC system based on the user-input commandsreceived via touch-sensitive user-interface 294. The user can perform anupward finger swipe to increase the temperature, a downward finger swipeto decrease the temperature, and can toggle the HVAC system's power bytapping on the surface of touch-sensitive user-interface 294. Further,microcontroller 288 can configure power-output controller 289 to monitoran amount of energy consumed by the HVAC system, which facilitates theuser to create rules for controlling the HVAC unit based on the user'scommands as well as an amount of power being consumed by the HVAC systemand/or other appliances.

FIG. 2H illustrates an mDimmer interfacing device 298 in accordance withan embodiment of the present invention. Specifically, device 298includes at least a reset button, a touch-pad area, and a status LEDindicator. The status LED indicator lights yellow when device 298 isfirst powered on in factory default mode out of the box, and lightssteady green when device 298 has been successfully integrated into anetwork and is working properly. Also, the status LED flashes when theLocate button is used in the mFi Controller software to display device298 on a map.

In some embodiments, an mDimmer or mSwitch device can communicate with anetwork-bridging interfacing device via a serial communicationinterface, such as an SPI or an I²C interface. The network-bridginginterfacing device can include a wired or wireless network connection toa local area network.

FIG. 2I illustrates a plurality of mDimmer interfacing devices 299coupled via a serial communication interface in accordance with anembodiment of the present invention. Specifically, an mDimmer device299.1 includes a network module, such as an Ethernet module or a Wi-Fimodule. Also, mDimmer devices 299.2-299.k may or may not include anetworking module, and can be coupled to device 299.1 via a serialconnection. For example, mDimmer device 299.1 can serve as a networkgateway to mDimmer devices 299.2-299.k. If an mDimmer device 299.ksubscribes to data from a remote interfacing device, mDimmer device299.k can receive real-time data (e.g., a sensor event from a remotedevice) via mDimmer device 299.1. Once mDimmer device 299.k receives thereal-time data, device 299.k can process one or more rules that areactivated by the received data.

Interfacing Device as a Data Server

In some embodiments, interfacing device 200 can function as a dataserver to send real-time data from an attached physical device to aremote device that has subscribed to this data (e.g., a controllerhosted by computer cluster 152 of FIG. 1B). For example, packetgenerator/parser 212 can receive a condition-subscription request fromthe remote device, which subscribes the remote device to receivingcondition-alert messages from interfacing device 200.

The condition-subscription request can indicate a condition for wheninterfacing device 200 is to send updated state and/or sensormeasurement data from an attached physical device to the remote device.Interfacing device 200 can store the received condition within storageunit 210 in association with the remote device (e.g., in associationwith an IP address for the remote device, and/or any othernetwork-reachability information or device identifier for the remotedevice). Then, when interfacing device 200 determines that the conditionhas been met (e.g., when a sensor measurement from an attached physicaldevice satisfies the condition), interfacing device 200 can send acorresponding condition-alert message to the remote device (e.g., basedon the device's network-reachability information). Interfacing device200 can send the corresponding condition-alert message to the remotedevice using network-addressing information associated with a networkconnection to the remote device. The condition-alert message canindicate that the condition has been met, and/or can indicate a stateand/or sensor measurement from the physical device coupled tointerfacing device 200.

Interfacing Device as a Data Client

In some embodiments, interfacing device 200 can function as a dataclient to receive state and/or sensor measurement data from a remoteinterfacing device (e.g., for one or more physical devices attached tothe remote interfacing device) or from a central controller. Interfacingdevice 200 can use the data it receives to modify its operating state.Specifically, storage unit 210 can store one or more compound rules thatare to be executed by interfacing device 200. A compound rule canindicate a set of conditions that trigger an action, and can indicate anaction description for the action. Interfacing device 200 can select andprocess a rule based on the received data, and modifies its operatingstate based on a rule's action description.

The central controller can analyze a set of rules to identify a remoteinterfacing device from which interfacing device 200 needs to receivedata for a physical device, and to identify conditions associated withthe data. For example, the controller may determine that it needs toreceive a temperature measurement from a physical device X attached to aremote interfacing device Y when physical device X determines that thetemperature has reached above 100° F. The controller can provideinterfacing device 200 with device-accessing information for the remotedevice, which interfacing device 200 uses to establish a networkconnection with the remote device.

Specifically, interfacing device 200 can use packet generator/parser 212to send a condition-subscription request to the remote interfacingdevice, which subscribes interfacing device 200 to receivingcondition-alert messages from the remote interfacing device. Onceinterfacing device 200 has successfully subscribed to receivingcondition-alert messages, the remote interfacing device will send acondition-alert message to interfacing device 200 once the desiredcondition has been met. The condition-alert message can indicate thatthe condition has been met, and/or can indicate a state and/or sensormeasurement from a physical device coupled to the remote interfacingdevice.

Once packet generator/parser 212 receives a condition-alert message,interfacing device 200 can use storage unit 210 to store thestate/measurement data from the condition-alert message. Further,processing unit 208 identifies one or more rules from storage unit 210whose conditions are met by the state/measurement data received from thecondition-alert message and/or from other recent state/measurement datastored in storage unit 210. Processing unit 208 can execute an actiondescription for any rule whose conditions have been met.

System Operation

Returning to FIG. 1, communications between controller 102 andinterfacing devices 106 and 108 are achieved by exchanging communicationpackets, such as IP packets, over network 106, which can be an IPnetwork. In some embodiments, intermediate device 108 processes rawinput data received from coupled devices 110.1-110.n (e.g., bytranslating the raw analog or digital data into meaningful information,such as temperature or humidity readings). Interfacing device 108.1packages the translated data into IP packets, and sends the packets tocontroller 102, thus enabling user 104 to view such information. Inaddition, user 104 may issue a command, such as setting up a rulegoverning operations of the coupled physical devices. Controller 102 canpackage the user command into IP packets, and sends these packets to thecorresponding interfacing devices (e.g., devices 108.1 and 108.m), whichin turn parse these packets and execute the user command. Note that,because network 106 can include the Internet, user 104 and controller102 can be at any location where he has access to network 106, and stillbe able to monitor and control physical devices 110.

FIG. 3A presents a flowchart illustrating an exemplary method 300 forconfiguring a device controller in accordance with an embodiment of thepresent invention. During the initialization process of the system, thecontroller discovers a number of interfacing devices (also calledmPorts) that are part of the system (operation 302). In someembodiments, the controller and the mPorts are within a same local areanetwork (LAN) domain. In some other embodiments, the controllerinterfaces with the mPorts via a wide area network (WAN), such as theInternet.

To discover the interfacing the device, the controller can receiveuser-login information from the user, and the controller identifies theinterfacing devices associated with the user's account. The controllercan identify each interfacing device by its MAC address, and/or by itsIP address. Also, during the discovery phase, the controller can alsoautomatically detect certain physical devices (such as devicesmanufactured by the same vendor of the mPorts) coupled to the user'sinterfacing devices, regardless of whether the user has registered thesedevices to be associated with his user account.

Subsequently, the system can receive information for third-partyphysical devices coupled to the interfacing devices (e.g., forspecial-purpose devices coupled to the mPorts) (operation 304). Forexample, the user can interact with a GUI provided by the controller toinput a model number for the third-party device, and to identify whichmPort (e.g., identified by its MAC address) and which port on that mPortthe third-party device is coupled to. Recall that the mPort device caninterface with a physical device via an analog terminal, or via a serialcommunication port. The system can use the physical device's modelnumber to determine a descriptive label for the device, to determinetypes of data that can be observed from the device (e.g., an analog ordigital value, and a descriptive label for the observed value), as wellas which types of data values can be provided to the physical device. Insome embodiments, if the system does not recognize the physical device,the user can use the GUI to enter parameters which indicate the datavalues that are to be expected from the physical device or can beprovided to the physical device, as well as descriptive labels for thesedata values.

The system can also receive device-configuration settings from the userfor the interfacing devices (operation 306). During this process, theuser can interact with the GUI to indicate locations on a map where theuser has placed or installed the devices, and can indicate how thesedevices are to operate. For example, the user can indicate an operationschedule for an mPort device, and can indicate a schedule and/orfrequency for monitoring a port on the device.

The controller further receives one or more rules defined by the user(operation 308). Each rule defines the conditions that trigger anaction, and which action(s) are to occur once those conditions are met.A rule's condition can include condition elements that take as inputsensor measurements for one or more physical values. The sensed physicalvalues can include, for example, a time value, a temperature, a humiditylevel, a power level, a voltage, a current, a detected motion, an on/offstate (e.g., for an electrical load), an open/close state (e.g., for adoor), light level, (e.g., an ambient light), and a moisture level.

Further, a condition element can include a comparison operation, whichcan be evaluated by comparing a sensor measurement to a predeterminedvalue (e.g., to a constant value), or to another sensor measurement. Thecomparison can include, for example, whether the sensor measurement is agreater-than, less-than, or equal to the predetermined value or othersensor measurement. A condition element can also include an evaluationor comparison of a time-related physical value. For example, thecondition element can take the current time as input, and compares thecurrent time to a predetermined time value. As another example, thecondition element can take a time duration for a sensor's current state,such as an amount of time that the sensor state has remained at itscurrent value, or remained above or below a predetermined thresholdvalue. The condition element can compare the time duration to apredetermined time, for example, to determine whether a sensor's statehas been at the current value (or above a given threshold) for at least10 minutes.

In some embodiments, a rule can be a compound rule that involvesmultiple devices. A condition element can include a logical operator,which can be evaluated by performing a logic operation on the outcome ofone or more condition elements. For example, a rule can state that oncea door sensor detects that a door has been opened and a motion-sensordetermines that no motion has been detected in the room (e.g., meaning aperson is entering the room), a light switch is to automatically turn ona light in the room. Also, another rule can state that once the door hasbeen opened and motion was previously detected in the room (e.g.,meaning the person is leaving the room), the light switch is to turn offthe light. Note that these rules define conditions (e.g., a door beingopened and motion/no motion being detected) that trigger a correspondingaction (e.g., turn the light on or turn off), and can involve multipledevices (e.g., the door sensor, the motion sensor, and the lightswitch). The controller can then store the rules within a rulerepository (operation 310), thus configuring the controller to performactions based on the rule definitions and data from the physicaldevices.

A rule's action description indicates one or more operations that are tobe performed when the condition's criteria is met. The actiondescription can include one or more actions that are to be performed,such as to turn a digital output signal on or off, with an optional timelimit (e.g., turn the digital output signal on or off for 10 minutes, orto do so after 10 minutes). As another example, the action descriptioncan specify a script that is to be processed by the interfacing device.The script can include a sequence of instructions that are to beperformed by the interfacing device to achieve a desired outcome. Also,the action description can indicate that the interfacing device is tosend an message to a target entity (e.g., an email message), or togenerate an event, which is stored within an event log for anadministrator to see.

In some embodiments, if the interfacing devices (the mPorts) are toexecute the rules (e.g., implementing a distributed-control system), thelocal controller (e.g., the user's personal computing device) can sendthe defined rules to the interfacing devices to which the involvedphysical devices are coupled. For example, the local controller can sendthe rules to an IP address associated with an interfacing device that isto execute the rule, or can send the rules to the interfacing device viaa network connection to the device.

FIG. 3B presents a flowchart illustrating an exemplary method 350 forpresenting configuration data and/or sensor data in accordance with anembodiment of the present invention. During operation, the controllercan present to the user a GUI that allows the user to select one or morephysical devices to monitor. The controller can receive a selection fromthe user for one or more interfacing devices to monitor (operation 352),and in response to receiving the selection, the controller obtainshistorical and/or real-time data for the physical devices (operation354). The system can obtain the data from a local sensor-data repository(e.g., in a local database), or can request the data from interfacingdevices to which the physical devices are coupled. The controller canthen present device-configuration information associated with thesephysical devices, and can also present historical and/or real-time datato the user via the GUI (operation 356). For example, the user canselect a temperature sensor, and the mPort associated with thetemperature sensor sends temperatures detected by this sensor over aspecified time period to the controller. The GUI can include a map thatillustrates an icon for temperature sensor at its correspondinglocation, can display a current or recent temperature measurement nextto the sensor's icon on the map. The GUI can also include a table orline graph that presents historical temperature measurements from thetemperature sensor.

User Interface Views

FIG. 4A presents a flowchart illustrating an exemplary method forconfiguring a device-placement space for a space-view graphic userinterface (GUI) in accordance with an embodiment of the presentinvention. During operation, the controller can receive deployment-spacedata for a device-deployment area (operation 402). The deployment-spacedata can include, for example, map coordinates for an outdoor area(e.g., a street map) within which a set of physical and/or interfacingdevices have been deployed, or an image which represents a map for anindoor area (e.g., a floor plan) or an outdoor area. As another example,the deployment-space data can include a static picture of a room withinwhich a set of physical devices have been deployed, or can include alive video feed for the room or space (e.g., from a tilt-zoom camera).The user can upload an image for a given space by selecting an existingimage file from a storage device accessible from his personal computingdevice, or by selecting a source for the image or real-time feed (e.g.,a network address, a port number, and/or client credentials). The usercan also upload the image by taking a picture of the space (e.g., usinga camera attached to a smartphone, tablet computer, or laptop computer),and uploading the resulting picture to the controller.

If the deployment-space data is for a map of an outdoor area, the usercan provide the deployment-space data to the controller by indicating ageographic area which covers the set of deployed devices. The user canindicate the geographic area by providing two or more sets of geographiccoordinates associated with the deployed devices (e.g., by providing thegeographic coordinates of an area that covers the devices, or thegeographic coordinates of the devices themselves), and the system candetermine a geographic region to present to the user so that the regioncovers the deployed devices. Alternatively or additionally, thecontroller can provide a space-view GUI that allows the user to navigatean interactive map (e.g., a street map or a satellite-view map). Theuser can provide the geographic area by navigating the interactive mapto the area that covers the deployed devices (e.g., by entering a cityname or zip code into a search field and/or by panning across theinteractive map), and by adjusting the zoom level to cover a desiredarea that surrounds the deployed devices.

Once the controller receives the deployment-space data, the controllercan provide a space-view GUI that includes a visual representation forthe device-deployment space (operation 404), and can obtaindevice-placement information for one or more devices deployed in thisspace (operation 406). The controller can obtain the device-placementinformation from a device repository that includes configurationinformation for a plurality of physical and interfacing devices. Thecontroller can also obtain the device-placement information from theuser when the user drags an icon of a physical device or an interfacingdevice onto a location on the visual representation for the deploymentspace, such that the target location represents the deployment locationfor the device. Once the user finishes placing the deployed devices onthe visual representation, the user can click on a “Save” button of thespace-view GUI to finalize settings, at which point the controller canstore the deployment-space data and the device-placement information(operation 408).

In some embodiments, while the user is interacting with the space-viewGUI, the controller can receive a recent device-state and/or a sensormeasurement for one or more of the deployed devices (operation 410). Inresponse to receiving this new data, the controller can update thespace-view GUI to present this information to the user, for example, byoverlaying the device icons and their recent state and/or measurementdata over the visual representation of the device-deployment space(operation 412).

FIG. 4B presents a flowchart illustrating an exemplary method 430 fordisplaying and updating a space-view graphic user interface (GUI) inaccordance with an embodiment of the present invention. Duringoperation, the controller can display a space-view GUI that illustratesa visual representation of a device-deployment space overlaid withdevice icons and their corresponding state and/or sensor-measurementdata (operation 432). For example, the controller can present thedevice's state using an icon which indicates whether the device isactive (e.g., being utilized), available but inactive (e.g., not beingutilized), or non-responsive (e.g., turned off, without networkconnectivity, or malfunctioning). Further, the controller can presentthe device's sensor-measurement data by displaying an alphanumeric valueor any graphical image which represents the recently measured value(e.g., a numeric value for a temperature reading, or an image of an LEDfor an on/off value or any binary value).

In some embodiments, the controller can determine whether it hasreceived an updated state or measurement from a device (operation 434).If so, the controller can update the space-view GUI to illustrate theupdated device state and/or the updated sensor measurement (operation436). The controller can then return to operation 434 (e.g., after adeterminable delay period) to receive an updated state or measurementfrom the same device or from a different device.

Otherwise, if the controller has not received an updated state ormeasurement, the controller can determine whether the currentlydisplayed state or measurement data has timed out (operation 438). Ifthe currently displayed data has timed out, the controller can updatethe space-view GUI to remove the timed-out data, and/or to indicate thatthe data has timed out (operation 440). The controller can then returnto operation 434 to determine whether it has received an updated stateor measurement from the same device or from a different device.

FIG. 4C presents a diagram illustrating an exemplary space-view GUI 460provided by the controller in accordance with an embodiment of thepresent invention. GUI 460 includes a central display area 462, a sidepanel 464, and a number of selectable tabs, such as a spaces tab 466, adata tab 468, an events tab 470, a rules tab 472, and a device tab 474.Central display area 462 displays information, such as images, graphs,and control panels, associated with a selected tab. In FIG. 4C, theselected tab is “spaces” tab 466, and the central display area 462displays the layout of a building showing the locations of a set ofinterfacing devices (mPorts) and physical devices using appropriateicons. For example, an icon 476 represents an mPort, and an icon 478represents a temperature sensor.

In some embodiments, a user can upload a space-view image by selectingan existing image of a map or a room on the user's computer, or bytaking a picture of a room using the user's smartphone camera. In someother embodiments, the space-view image can include a captured image orreal-time feed from a security camera. In some embodiments, the user canuse an image obtained from an Internet-based map service (e.g., theGoogle Maps web service) to demonstrate the location of mPorts andphysical devices.

The content of side panel 464 is also associated with the “spaces” tab,and can display a list of available devices that can be dragged toappropriate locations on the space shown in central display area 462. Inaddition, a user can also drag a device icon (e.g., an icon for an mPortdevice) from its current location on the space-view image to a newlocation. In FIG. 4C, central display area 462 also includes a zoomslider 480 that can be used to zoom the map in and out.

FIG. 4D presents a diagram illustrating an exemplary space-view GUI 480provided by the controller in accordance with an embodiment of thepresent invention. GUI 480 includes a central display area 482, whichcan display a user-selected image of a room within which a set ofsensors are deployed, or can display a real-time feed from a securitycamera that covers a desired portion of the room, or a real-time feedfrom a user's hand-held portable device.

The user can drag a device icon from the side panel of GUI 480 onto alocation of display area 482 associated with the corresponding device.The controller can store a display location for the device, which allowsthe system to overlay the device icon over the same location of displayarea 482 relative to the image of the “space.” In some embodiments, ifdisplay area 482 is presenting a real-time feed from a pan/tilt/zoomsecurity camera, the controller can adjust the location of the deviceicon along display area 482 as the camera pans, tilts, and/or zooms.This causes the device icon to appear to remain locked to a portion orlocation of the room. Similarly, if display area 482 is presenting areal-time feed from the user's hand-held portable device, the controllercan obtain geographic coordinates and an orientation for the portabledevice. The controller then determines a set of device icons to display,and can adjust the location of the device icons along display area 482as the user moves, pans, tilts, and/or zooms his portable device'scamera.

In some embodiments, a user can interact with a device icon to controlthe type of information that is presented, or to control the interfacingdevice and/or physical device associated with the device icon. Forexample, device icon 484.1 corresponds to a current-metering device fora wall-mounted light fixture. The user can view an amount of currentbeing consumed by the light fixture to determine whether fixture's lightbulb is wearing out or has gone out. Also, device icons 484.2 and 484.3may correspond to a thermostat, and may indicate a current roomtemperature and a humidity measurement, respectively.

Device icon 484.4 can correspond to a sensor that indicates whether adoor is open or closed, and device icon 484.5 can correspond to a motionsensor (e.g., a sensor built into a light switch). In FIG. 4D, the userhas activated device icon 484.5, which causes the controller to displaya detected motion level using a color within a quarter circle. Thecontroller also overlays a set of control icons surrounding the deviceicon. The control icons allow the user to control the information thatis presented from the corresponding device, and/or to control the deviceitself. For example, the control icons can include: a “chart” icon; a“details” icon; a “lock” icon; and a “remove” icon.

The “chart” icon Displays a chart of color coded values representinglow, average, and high values or event frequency based on the type ofdevice. The “details” icon allows the user to open a details-view windowfor viewing detailed information for the physical device, such as aname, model, and mPort identifier for the interfacing device, and a portassociated with the physical device. The detailed information can alsoinclude historical state/sensor data, as well as historical events. Insome embodiments, the details-view window also allows the user tocontrol the device, such as to turn a light on or off.

The “lock” icon for locking the selected sensor to the current locationon the space's image, and disables the “remove” icon functionality forthe sensor while the sensor icon is locked. The “remove” icon allows theuser to remove the sensor from the location in display area 482.

If the device is a serial-based sensor, the controller also displays a“shell” icon, which allows the user to open a command-line interfaceshell for interacting with or controlling the device.

FIG. 4E presents a diagram illustrating an exemplary space-view GUI 490provided by the controller in accordance with an embodiment of thepresent invention. GUI 490 includes a central display area 492, whichcan display a geographic map for a geographic region selected by theuser. The controller can present a map, for example, from anInternet-based map service (e.g., the Google Maps web service) to theuser, and the user can interact with the map to navigate to a desiredlocation by scrolling and/or zooming to a desired view for display area492.

The user can drag a device icon from the side panel of GUI 490 onto alocation of display area 492 associated with the corresponding device.GUI 490 includes a set of exemplary device icons, such as amotion-sensing device icon 294, a power-sensing device icon 295, and atemperature-sensing device icon 297. In some embodiments, the controllercan determine a geographic location associated with a device icon basedon the location of display area 492 onto which the user placed thedevice icon. The controller associates this geographic location with thedevice (e.g., in a device-location repository), which allows thecontroller to display the device icon in the same location of displayarea 492 relative to the “space” image, even as the user scrolls orzooms through the space. Also, by attributing a geographic location tothe device icon, the user can monitor and/or control the device by usingan augmented-reality application on a mobile device.

Location-based Device Visualizations

In some embodiments, the controller allows a user to view data from oneor more devices based on their location or geographic location. Thecontroller can determine a device's geographic location from thedevice's built-in GPS (global positioning system) sensor, by performingWi-Fi triangulation, or by obtaining the device's location identifier orgeographic location from a device-location repository.

For example, if the user is using a geographic map UI to view the devicedata (e.g., GUI 490), the controller can overlay the data so that itincludes data from sensors associated with the geographic region coveredby the map UI. If the map UI is zoomed out so that multiple device iconsare overlapping, the controller can replace the overlapping device iconswith an aggregated-device icon. In some embodiments, theaggregated-device icon indicates a number of devices that areoverlapping within the corresponding region. In some embodiments, if theaggregated-device icon is replacing icons for devices of the same type,controller can generate the aggregated-device icon so that it indicatesan aggregated value. The aggregated value can indicate, for example, amean or median sensor measurement, a sum of the sensor measurements, orany result computed from the sensor measurements using a mathematicalfunction.

Then, if the user zooms further into the map so that one or more of thedevices are no longer overlapping with other devices, the controller canupdate the overlaying icons as necessary. For example, the controllercan update the map UI to display the non-overlapping device iconsexplicitly, and to generate the aggregated-device icon so that itindicates a value computed from the remaining overlapping device icons.

In some embodiments, the controller can provide device data to a user'smobile device for display within an augmented-reality visualization.Similar to GUI 490 (FIG. 4E), the controller provides the mobile devicewith device data for interfacing devices and/or physical devices thatare within the UI display area (e.g., within the user's current view).Because the user may be aiming his mobile device's camera in a directionthat includes distant devices (e.g., temperature sensors distributedacross a city), the controller may only provide the mobile device withdata for devices within a threshold distance from the user's mobiledevice.

Similar to UI 480 (FIG. 4D), the user's mobile device overlays deviceicons on top of a real-time image feed captured from the mobile device'scamera. As the user pans, tilts, or zooms his mobile device's camera,the augmented reality system updates the overlaid device icons to onlyinclude icons for those devices that are within the user's field ofview. The augmented reality system selects the icons to overlay on topof the captured images based on the orientation and geographic locationfor the user's mobile device, as well as known geographic locations forthe interfacing devices and physical devices. The user can interact witha device icon to control the type of information that is presented, orto control the interfacing device and/or physical device associated withthe device icon.

Generating and Processing Rules

FIG. 5A presents a flowchart illustrating an exemplary method 500 forgenerating and storing rules for controlling an interfacing device or aphysical device in accordance with an embodiment of the presentinvention. A rule can include one condition, or can include a pluralityof conditions. For example, a single device can be associated with twoor more conditions, or there may be a plurality of devices that are eachassociated with at least one condition. A rule can also include anaction that is to be performed when the conditions are met.

During operation, the controller can receive (e.g., via a rule-view GUI)a selection from a user for one or more devices to monitor (operation502). An interfacing device can include an mPort interfacing device, anmPower or mOutlet interfacing device, or an mSwitch or mDimmerinterfacing device.

As mentioned earlier, the mPower or mOutlet interfacing device canimplement a power strip that can provide the controller with an amountof power being consumed by each of its outlets, and can control power toan outlet based on an outcome of processing a rule's action description.The interfacing device or controller can determine from the powermeasurements whether a certain appliance is being used or is in astandby mode. Thus, the user can select an outlet of the power strip tomonitor an operating state of a corresponding appliance being powered bythe selected outlet, and the user can specify a voltage value as thecondition for triggering an action.

The mPort interfacing device can interface with one or more physicalsensors to obtain an analog or digital value from each sensor. Thus, theuser can select a sensor coupled to the interfacing device, and canspecify a raw value (or a descriptive label associated with the rawvalue) as the condition for triggering an action.

The controller can also receive a condition value for each of one ormore devices or nested conditions (operation 504), and acondition-processing type, which indicates how to process the conditionsfrom the one or more devices (operation 506). For example, thecondition-processing type can indicate that the rule's conditions aremet when either any, all, or a certain number of the individualcondition elements have been met (e.g., none, one, two, all, etc.). Insome embodiments, a condition element can include a target value for aphysical device being monitored.

In some embodiments, a condition element can include a nested condition,which itself has a condition type. Hence, a rule's condition canimplement complex logic statements, such as a sum-of-products (SoP) or aproduct-of-sums (PoS) logic expression. As an example, the rule'scondition can include a top-level condition which indicates that allcondition elements need to be met (e.g., implementing an “AND” logicexpression), and a nested condition can indicate that at least one ofthe nested condition's elements need to be met (e.g., implementing an“OR” logic expression).

In some other embodiments, a condition element can include a “schedule”condition, which indicates a time instance or time range during whichthe rule can be processed. An interfacing device can use a schedule'stime (e.g., a starting time) to trigger the evaluation of the rule,and/or to determine whether the rule can be processed if the rule istriggered by another event (e.g., by a condition element associated witha physical device).

Further, the controller can receive an action description for a desiredaction (operation 508). The user can provide the action description byinteracting with a rule-view GUI to indicate one or more actions thatare to be taken by one or more interfacing devices. These actions caninclude setting an output voltage for a certain port of the interfacingdevice to a predetermined target value. In some embodiments, the actiondescription can be in the form of a script that is to be executed by oneor more target interfacing devices.

Once the user has configured the rule elements, the controller cangenerate the rule, which triggers the desired action in response to theconditions being met as indicated by the condition-processing type(operation 510). The controller then stores the generated rule in a rulerepository (operation 512), for example, at an interfacing device and/orwithin a database of an application server.

FIG. 5B presents a diagram illustrating an exemplary view of the graphicuser interface (GUI) of the controller in accordance with an embodimentof the present invention. Like FIG. 4C, GUI 550 includes the centraldisplay area, the side panel, and the selectable tabs. In FIG. 5B, theselected tab is the “action” tab, which allows the user to define a setof rules. The side panel displays a list of previously defined rules,such as a door-open rule 552. By clicking on a rule, the user can viewthe rule in the central display area, which includes a rule-name field554, a condition field 556, and an action field 558.

Condition field 556 includes a set of condition elements that cantrigger the evaluation of the rule, and which are analyzed to determinewhether to process the rule's action description. Condition field 556can. A condition element can include variable that selects a device ornested condition, and can include another variable that defines whichconditions associated with the device or condition will trigger therule. Condition field 556 can also define whether the rule is triggeredby meeting any or all listed condition elements (not shown).

In the example illustrated in FIG. 5B, the rule name is “Rule 123,” afirst device associated with the rule is “Outlet 1,” and thecorresponding condition-value indicates that the outlet's power needs tobe greater than 1 watt for the condition element to be satisfied. Asecond device associated with the rule is a “Sensor” that monitors ananalog input signal, and the user can set a correspondingcondition-value indicates a minimum voltage that needs to be reached forthe condition element to be satisfied. The user can add a conditionelement for another physical or interfacing device by selecting an “add”button 562. Also, the user can add a condition element that indicates aschedule for the rule by selecting a “schedule” button 564.

Action field 558 displays actions to be taken once the conditions aremet. In the example illustrated in FIG. 5B, once the conditions are met,the system can cause Outlet 1 to remain on for 10 seconds, and canconfigure a “floor fan” physical device to be turned on for 0.08minutes. The user can also add other actions to action field 558, suchas to execute a script, to configure an output of an interfacing device(e.g., an output that controls the “floor fan”), and/or to send anotification (e.g., by sending an email to a specified email addressand/or generates a system alert).

Also, the user can use GUI 550 to edit and update an existing rule 552,to define a new rule by clicking a new-rule button 560, and/or to enableor disable a rule.

FIG. 5C presents a user interface 560 illustrating exemplary pre-definedconditions that can be incorporated into a rule's condition set inaccordance with an embodiment of the present invention. Specifically,condition sets 562 include a set of conditions associated with variousphysical contexts. For example, the conditions “motion by window 2,”“motion by window 3,” “conference room motion,” “Motion: mFi Lab 1”evaluate to “true” when a motion detector has detected a motion near aspecific physical space. The condition “beam detector” evaluates to“true” whether an infrared beam has been broken, which indicates that anobject has passed through a specific location (e.g., at a door'sthreshold). The condition “Door 1” and “Door 2” evaluate to “true” whena corresponding door is left open.

Also, “schedules” set 564 can indicate a plurality of time schedulesassociated with a user context. For example, a “night-time” schedule canindicate when light fixtures should not be turned on within a givenbuilding or space, and a “security” schedule can correspond to a timeperiod when nobody is expected to be within a given building. A “waterback yard” and a “water front yard” can indicate a time range whensprinklers can be activated to water a back yard, or a front yard,respectively.

FIG. 6A presents a diagram illustrating an exemplary device-view GUI 600of the controller in accordance with an embodiment of the presentinvention. In FIG. 6, the selected tab is the “device” tab, and thecentral display area of GUI 600 displays two panels for viewing datarelated to a set of devices. Specifically, panel 602 displays a list ofphysical devices that the user can monitor, and a panel 604 displays alist of interfacing devices (mPorts) associated with the user. The usercan interact with GUI 600 to manually add or remove physical and/orinterfacing devices, and to view a current operating state for thesedevices.

FIG. 6B presents a diagram illustrating an exemplary data-view GUI 630of the controller in accordance with an embodiment of the presentinvention. GUI 630 includes a central display area, a side panel, and aset of selectable tabs associated with various views. In FIG. 6B, theselected tab is the “data” tab, which allows the user to view datagathered from one or more physical and interfacing devices.

The side panel shows three selection panels: a date-range panel 632, aview-selection panel 634, and a device panel 636. Device panel 636displays a list of available devices categorized by type. By clicking onone or more devices, a user can view the data for the devices on thecentral display area. The user can use date-range panel 632 to specify atime period for the displayed data, and can use view-selection panel 634to create a customized view of the data within the specified timeperiod. If the user creates a customized view, the system can re-use thecustomized view to present data to the user in the format desired by theuser. In the exemplary view provided in FIG. 6B, the central displayarea displays two graphs showing temperature vs. time for two selectedtemperature sensors.

In some embodiments, the central display area can also display thehistorical sensor data on a map or space (not shown). For example, theuser can select a time period or time range, and the system can updateGUI 630 to place a sensor value (e.g., an average sensor value or agraph of sensor values) next to a device icon overlaid over an image forthe map or space. GUI 630 can also present the user with a set of eventsthat were triggered by the devices over time. The user may select a“play,” “rewind,” or “fast forward” button to select a rate for viewinghow the sensor event notifications were triggered over time, and/or seehow the sensor values change over time. Alternatively, the user cancontrol a scrubber to select a specific time instance or time intervalfor which to display sensor events and/or sensor values.

GUI 630 also enables mouse-over functions that allow a user to use themouse to hover over the data timeline to view specific details and toclick and highlight specific areas of the timeline to zoom in on aspecific section of the timeline. In one embodiment, a magnifying glassicon appears as the user hovers a mouse pointer over the data timeline,and the time frame selected by the user will be highlighted as the userclicks and drags the mouse pointer across the timeline. Once the usercompletes his time frame selection, all devices in the view will zoominto the selected time frame.

FIG. 6C presents a diagram illustrating an exemplary events-view GUI 660of the controller in accordance with an embodiment of the presentinvention. GUI 660 includes a central display area, a side panel, and aset of selectable tabs. The selected tab in GUI 660 is the “event” tab,which allows the user to see historical events associated a set ofdevices. Note that an event is referred to a one-time execution of arule.

The side panel shows three panels: a filter panel 662; a date-rangepanel 664; and a device panel 666. The central display area displays thehistorical event information. Device panel 666 displays a list ofavailable devices categorized by type, and the user can select one ormore devices for which to view historical event data. Filter panel 662allows the user to filter data using specific search criteria. Morespecifically, a user can enter a text string in filter panel 662, andthe controller uses the entered text string to perform a real-timesearch by removing event data that does not match the entered textstring. The user can also use date-range panel 664 to specify a timeperiod for the event data that is to be displayed in the central displayarea. The controller does not display events that occurred outside ofthe specified time period.

In GUI 660, the central display area includes multiple display regions,such as regions 668, 670, and 672. Region 668 uses a bar graph todisplay a temporal distribution of the events generated during thespecified timeframe. Each bar represents events that occurred within aunit of time, which by default is set to 2-hour blocks of time. A usercan click on a bar to display the events associated with the block.

Region 670 displays a pie graph showing a device-based distribution forevents that occurred during the specified time period. The controllercan update the temporal distribution graph and the device distributiongraph each time the user modifies the search or filter criteria. Region672 is the main display region that displays the list of events that fitthe search or filter criteria. Each event entry indicates: a time fieldthat displays the date and time when the event occurred; a device fieldthat displays the name of the device that generated the event; a typefield that display the type of event; a value field that displays thevalue that triggered the event; and a rule-name field that displays thename of the rule that triggered the event. When the user hovers themouse over an event, the controller can respond by displaying a windowthat presents the current location of the device in a corresponding“space” (e.g., by overlaying a device icon on a map, a stored image, orover a real-time video feed for a “space”), a 24-hour snapshot ofvalues, when the event occurred, the alarmed value, and the lastreported value, as shown by a region 674.

Interfacing Device Runtime Functionality

FIG. 7 presents a flowchart illustrating an exemplary method 700 forprocessing a rule at a local interfacing device in accordance with anembodiment of the present invention. During operation, the localinterfacing device can detect a rule-triggering event (operation 702),and selects a rule associated with the detected event (operation 704).The device can receive the event from a remote device, or can detect theevent locally, such as by monitoring a locally-attached physical deviceand/or monitoring a schedule-condition that triggers a rule. To selectthe rule that is triggered by the event, the local device can perform arule-lookup operation that selects, from the rule repository, at leastone rule that includes a condition associated with the detected event.For example, the remote device may include an mPort device that receivesinput from a door sensor, and the local interfacing device can selectone or more rules whose actions are triggered when the door sensorindicates that the door is open or closed.

In some embodiments, a condition can include a plurality of sensorvariables that need to be evaluated to determine whether the conditionis met. Further, the condition can also include a reference to a nestedcondition, and the device needs to first evaluate the nested conditionto determine its outcome.

Once the local device selects the rule to process, the local device candetermine whether the rule's condition requires other input data(operation 706). The rule can include one or more condition elementsassociated with, for example, a physical device (e.g., a motion sensor),a schedule-condition, and/or a nested condition. If the rule's conditiondoes not require other inputs, the local device can process the ruleusing the received data that indicates recent state or measurement datafrom the remote interfacing device (operation 712).

However, if the rule's condition does require other inputs, the localdevice can determine other input data sources for the rule (operation708), such as sensor data, rule-scheduling data, or an outcome of anested condition. The local device then obtains the necessary data forthe other input-data sources (operation 710), and proceeds to operation712 to process the rule using the obtained state and/or measurement dataassociated with the rule.

After processing the rule, the local device can determine whether therule conditions have been satisfied by the device state and/ormeasurement data (operation 714). If so, the local device can process anaction description associated with the rule (operation 716). Otherwise,the local device may ignore the rule or perform a remedial action (e.g.,ignore the rule for a determinable time period).

The action description, for example, can include a command to configureone or more target intermediate device or physical device to apredetermined state. As another example, the action description caninclude a script which performs a complex operation. In someembodiments, the script can compute a target state for the local deviceby executing a sequence of instructions to process the recent and/orhistorical state and measurements from one or more physical devices. Thelocal device also determines whether there are more rules associatedwith the updated state or measurement (operation 718), and can return tooperation 704 to select another rule if it exists.

Note that it is possible for two rules with overlapping conditions(e.g., conditions that allow both their actions to be performed) to haveconflicting actions. One rule's action may involve turning on a light,while the other rule's action may involve turning the same light off. Ifboth rules were to be processed in “parallel,” the execution of the tworules may be performed in any order (not necessarily simultaneously),such that one rule's action does not affect the next rule's execution.In the example above for controlling the light, if both rule'sconditions are met and both rules are executed substantially inparallel, the light's final state depends on which rule is processedsecond. This unexpected order of execution can cause unexpectedbehavior.

In some embodiments, the local device processes one rule at a time, andprocesses them in an order specified by the user. For example, the localdevice performs operation 718 to select another rule in an ordered setonly after performing operations 714 and/or 716 to process the previousrule. Also, if executing a rule changes a device's state, the next rulein the ordered set is processed according to the device's new state.Processing rules in this way ensures that there is only one expectedbehavior for each updated state/measurement that is obtained from aninterfacing device.

Cloud-Based Implementation

In some embodiments, the controller resides and operates within a servercluster (e.g., the “cloud”). The controller can monitor and controlinterfacing devices for a plurality of different users by communicatingwith each interfacing device using IP packets over a wide area network,such as the Internet. When a user first deploys an interfacing devicewithin his LAN, the user can pair the interfacing device with hispersonal account at the controller. For example, the user can enter hispersonal account number and password when configuring the interfacingdevice. Alternatively, the user can pair his interfacing device withoutrevealing his password, for example, by registering his interfacingdevice's unique identifier (e.g., a MAC address) with the controller, orby authorizing the interfacing device via an open-authorizationprotocol.

Also, if the user desires to interact with the controller to monitor orcontrol one or more devices within his LAN, the user can access a UI forthe controller via a Web browser, or using an application thatinterfaces with the controller's Web APIs (e.g., using a mobileapplication for a smartphone or tablet computer, or using a softwareapplication on a personal computer).

FIG. 8 illustrates an exemplary computer system 800 for interfacing acontroller 802 within a server cluster with devices within a LAN 808.Computer system 800 includes controller 802 coupled to a WAN 804.Computer system 800 also includes an interfacing device 810 and acomputing device 812 within a LAN 808, and includes a router/firewall806 that separates LAN 808 from WAN 804.

During operation, the devices within LAN 808 can establish a networkconnection to controller 802, or to one or more peer devices within LAN808. For example, controller 802 can store network-addressinginformation in a database for each device, and maintains thenetwork-addressing information up-to-date to facilitate communicatingwith these devices. This allows a user to use a personal computer (e.g.,computing device 812) to reconfigure one or more interfacing deviceswithin LAN 808, and/or one or more rules for the interfacing devices.The user's personal computer can include a software application thatprovides a UI for monitoring and/or configuring the device-interfacenetwork, and uploads any configurations to controller 802. The user'spersonal computer can also include a Web browser that accesses the UIfrom controller 802.

When the user enters and commits configuration changes to thedevice-interface network, controller 802 compiles the user'sconfigurations into a device-specific configuration for one or moredevices whose configuration needs to be updated, and sends the updatedconfiguration to these interfacing devices via network-addressinginformation associated with their corresponding network connection. Thedevice-specific configuration can include an update to the interfacingdevice's network configuration, rule configurations, network-addressinginformation for one or more peer devices (e.g., to subscribe to datathat serve as inputs to one or more rules), etc.

Further, in some embodiments, each device within LAN 808 can alsoestablish a network connection to any device to which it has a datasubscription, and/or to any device that subscribes to its data. Thedevice can function as a server to receive and respond to requests fordata, from a peer device (or from controller 802). The device can alsofunction as a client device, as it can receive unsolicited data (or arequest for data) from a remote device, and can use network-addressinginformation associated with a network connection to the remote device topush real-time data to the remote device. Thus, even if LAN 808 becomesdisconnected from WAN 804 (and thus, from controller 802), the deviceswithin LAN 808 can continue to communicate with each other using theestablished peer-to-peer connections, and functioning as both serversand clients.

During operation, controller 802 can receive IP packets from device 810or device 812 via a port-tunneling channel 814.1 or a port-tunnelingchannel 814.2, respectively. In some embodiments, port-tunnelingchannels 814 can include network connections created by long-pollingrequests that temporarily open a port within router/firewall 806 (e.g.,created by protocols such as STUN (Session Traversal Utilities for NAT),Comet, etc.). These long-polling requests temporarily open a port withinrouter/firewall 806 that can be used by controller 802 to issue aresponse packet.

For example, in some embodiments, controller 802 needs to sendunsolicited data to interfacing device 810 (e.g., real-time data or aconfiguration for device 810), or to send unsolicited data to computingdevice 812 (e.g., real-time data). The devices within LAN 808 canmaintain a persistent network connection with controller 802 byperiodically communicating a long-polling message/request to controller802 (e.g., an XHR message when using Comet, or a STUN message when usingSTUN). The message indicates a unique identifier for the device (e.g., aMAC address), which controller 802 uses to store the most-recentcommunication port for the device within a device-access repository.

In some other embodiments, port-tunneling channels 814 can includepersistent and bidirectional network connection, such as a channelestablished using the WebSocket protocol. To establish the WebSocketchannel, the device within LAN 808 sends to controller 802 a WebSockethandshake request, which upgrades an HTTP session to a WebSocket sessionand includes a Sec-WebSocket-Key token for controller 802. Controller802 responds by sending to the device a response that acknowledges theWebSocket session, and includes a Sec-WebSocket-Accept token that isderived from the Sec-WebSocket-Key token.

Recall that each device associated with the interfacing-device network(e.g., controller 802, device 810, or device 812) includes adevice-access repository that includes device-accessing information foreach computing device or interfacing device of the network. In someembodiments, the device-access repository associates a device's uniqueidentifier with one or more of: a port number associated with the deviceat router/firewall 806, an IP address for reaching router/firewall 806(e.g., a WAN IP address), and an IP address for reaching the devicewithin LAN 808. For example, when controller 802 needs to send a datapacket to device 810 or device 812, controller 802 can determine thenecessary IP address and a recent port number for the device from thedevice-access repository. Controller 802 can then send the data packetto the IP address via the recent port number of router/firewall 806.

Communicating Real-Time Data via a Peer-to-Peer Network Connection

In some embodiments, an interfacing device within LAN 808 cancommunicate real-time data to peer devices by obtaining thedevice-accessing information for a peer device from the device-accessrepository. The device-accessing information can indicate a networkaddress associated with a network connection to the target peer device,and can indicate authorization information for the local interfacingdevice (e.g., a username, a password, and/or a certificate). If thenetwork connection to the peer device is active, the local interfacingdevice can send the data to the peer device via the network connection,and using any required authorization information.

If the network connection to the peer device is not active, the localinterfacing device can establish the peer-to-peer network connection,for example, by obtaining device-accessing information for the peerdevice from a central controller. This peer-to-peer network connectionprovides for robust communication between peer devices, as it does notrequire the devices to communicate via WAN 804, and does not require acentral forwarding service (e.g., controller 802) to maintain orcomplete the network connection between the peer interfacing devices.

Communicating Real-Time Data Via a Forwarding Service

In some embodiments, an interfacing device within LAN 808 may not beable to establish a peer-to-peer network connection, for example, whentwo peer devices reside within different network domains. In thisinstance, the local interfacing device can communicate real-time data topeer devices by using a forwarding service, which can be provided bycontroller 802, or can be provided by a server that is separate fromcontroller 802 (not shown).

The device-accessing information can indicate network-addressinginformation associated with a network connection to the forwardingservice, a unique identifier for the peer device, and authorizationinformation for the local interfacing device (e.g., a username, apassword, and/or a certificate). For example, if the local device doesnot have a network connection to the peer device, the local interfacingdevice can send the data to the peer device via the forwarding service,and using any required authorization information. This allows two peerdevices to communicate real-time data with each other, even when the twodevices are not within the same network domain.

As a further example, the local interfacing device can receive real-timedata from a plurality of peer devices via the network connection to theforwarding service. The forwarding service can maintain a networkconnection to each interfacing device, and can use a network connectionto a respective interfacing device to send real-time data from any otherpeer device to which the respective device has subscribed. This allowsthe interfacing device to receive real-time data from a plurality ofpeer devices, without maintaining a network connection to eachindividual peer device.

In some embodiments, a user's personal computing device can communicatedirectly with the interfacing devices, or via a data-forwarding serviceif a direct network connection is not available. When the user turns onthe computing device (or launches a device-monitoring application), thecomputing device can use network-addressing information that the user'sdevice has stored for a previous snapshot of the network configurationto communicate with other devices. The user's computing device can alsoobtain the network-addressing information from the central controller ifthe information is not available locally.

FIG. 9 presents a flowchart illustrating an exemplary method 900 forestablishing a network connection to a remote device based onnetwork-addressing information received from a central controller forthe remote device in accordance with an embodiment of the presentinvention. As mentioned above, the network connection can include abidirectional channel established using the WebSocket protocol, or anetwork connection that is maintained using the STUN protocol, the Cometprotocol, or any other communication protocol now known or laterdeveloped.

During operation, the user's computing device determines a remote devicewith which to establish communication (operation 902), and determineswhether the computing device has network-addressing information for theremote interfacing device (operation 904). The computing device candetermine that it needs to establish a network connection with a remotedevice in response to the user interacting with a user interface formonitoring, configuring, and/or controlling the interfacing devices. Theuser's computing device can determine whether it has network-addressinginformation for the remote device, for example, by searching for acorresponding entry of the device-access repository.

If so, the computing device establishes a network connection with theremote device based on the network-addressing information (operation908), such as a peer-to-peer network connection, or a network connectionvia a data-forwarding service.

However, if the computing device does not have the network-addressinginformation, the computing device obtains the network-addressinginformation for the remote device from the controller (e.g., controller802 of FIG. 8) (operation 906). The computing device then proceeds tooperation 908 to establish the communication with the remote devicebased on the network-addressing information.

FIG. 10 presents a flowchart illustrating an exemplary method 1000 forestablishing a network connection with a remote device based on a storednetwork-addressing information for the remote device in accordance withan embodiment of the present invention. During operation, the user'scomputing device determines network-addressing information for a remotedevice (operation 1002), and tests a peer-to-peer connection with theremote device based on the network-addressing information (operation1004). In some embodiments, the computing device can test thepeer-to-peer connection by sending a request to access a predeterminedfile from the peer device. The file can include any file that isexpected to be stored by the target remote device, such that asuccessful request confirms that the desired interfacing device isreachable via the peer-to-peer connection.

The computing device then determines whether it succeeded inestablishing a peer-to-peer connection with the remote device (operation1006). If so, the computing device communicates with the remote devicevia the established peer-to-peer network connection (operation 1008).Otherwise, the computing device can establish a communication channelwith the remote device via a data-forwarding service (operation 1010).

Device Authentication and Communication Security

In some embodiments, to establish a peer-to-peer network connection, adevice at one end of the network connection needs to be authorized orauthenticated by the other device of the network connection. Forexample, two devices may communicate with each other by eachestablishing a one-way channel to the other device. The device thatestablishes a given one-way channel can function as the communicationclient (e.g., the receiver that subscribes to data), and the device thathosts the data can function as the communication server (e.g., thesender that streams the real-time data being subscribed to).

A one-way channel may be established and maintained using the STUNprotocol, the Comet protocol, XHR messages, or any other communicationprotocol now known or later developed. However, two devices mayestablish a persistent bidirectional communication channel, such as achannel established using the WebSocket protocol, or any otherbidirectional communication protocol now known or later developed.

In some embodiments, the controller can provide to each interfacingdevice a username and password for each communication client that cansubscribe to data from the interfacing device. The password can be inthe form of a plaintext value, a hash value, or a salted hash. Thecommunication client can provide a username and a password to thecommunication server to establish a one-way network connection, and thecommunication server can authorize the communication client if theusername and password match the known username and password receivedfrom the controller. The two devices can establish a bidirectionalnetwork connection by each providing a username and password to theother device, and authorizing the other device based on the receivedusername and password.

If the controller provides the client passwords to the interfacingdevices (communication servers) as an encrypted hash value or saltedhash, the controller can also provide the interfacing devices with anencryption key (and salt if necessary) for generating the hash value orsalted hash. Each interfacing device can receive one key and salt thatcan be used by its communication clients. The controller does notprovide the interfacing devices with a corresponding decryption key fordecrypting the password from the hash or salted hash. Thus, whenestablishing the network connection, the interfacing device can providethe encryption key and salt to the communication client, so that theclient does not expose its personal password to the interfacing device.The communication client can use the encryption key and salt to generatethe hash value or salted hash for the password, and provides theusername and the password hash or salted hash to the communicationserver to establish a secured network connection.

In some embodiments, the controller can provide, to each interfacingdevice, a digital certificate that indicates a domain to which theinterfacing device belongs, and can indicate other domains with whichthe interfacing device can communicate. The controller can function as acertificate authority (CA) to sign the digital certificate, or caninteract with a third-party CA to assign a digital certificate to aninterfacing device. To establish a one-way network connection, acommunication client can provide its digital certificate to thecommunication server, and the communication server can authorize thecommunication client if the digital certificate is valid, and if thedigital certificate indicates a domain to which the communication serverbelongs. Thus, in the interface-device network, communication occursbetween devices that belong to the same domain, or between devices thatare configured or allowed to communicate with devices in each others'domains. The two devices can establish a bidirectional networkconnection by each providing a digital certificate to the other device,and authenticating the other device based on the received digitalcertificate.

The two interfacing devices can also communicate over the persistentchannel using encrypted data. For example, the digital certificate canalso include a communication client's public key to facilitate theinterfacing devices to communicate over a secure channel. Thecommunication server can use the public key to encrypt data that is tobe sent over the network connection, and the communication client canuse a corresponding private key to decrypt the data that it receivesfrom the communication server. Alternatively, the two devices can securetheir data using the Kerberos protocol, or by tunneling their datathrough an encrypted connection, such as using a secure sockets layer(SSL) protocol or a transport layer security (TLS) protocol.

Load-Balancing

FIG. 11 illustrates an exemplary distributed system 1100 for aninterfacing-device network that includes a controller deployed on acomputer cluster 1102 in accordance with an embodiment of the presentinvention. Computer cluster 1102 can include a plurality of computingnodes 1102.1-1102.k, which can reside within a single location andinterconnected via a local network, or can be deployed across aplurality of geographic locations and interconnected via WAN 1104.

In some embodiments, a system administrator can deploy a set ofcomputing nodes at various geographic locations, and can deployredundant databases across the various geographic locations. Further,because the redundant databases across distributed system 1100 aresynchronized, the plurality of computing nodes of the computer cluster1102 can function as a single computing entity.

As interfacing devices are added or removed to/from distributed system1100, the administrator can adjust the computing capacity provided bydistributed system 1100 at various geographic locations to account forthe computing demands of these geographic locations. For example, theadministrator can deploy or remove computing nodes at a given geographiclocation as interfacing devices are added or removed from this location.Also, as use of the central controller fluctuates over time, computercluster 1102 can load-balance the loads across computing devices1102.1-1102.k, which increases the responsiveness of each computingnode, and also increases the responsiveness of computer cluster 1102 asa whole.

EXEMPLARY APPLICATION Light Dimmer

In some embodiments, system architecture 1100 can also include a dimmer1114 and a light fixture 1118. Dimmer 1114 can be in the same room aslight fixture 1118, or can control light fixture 1118 from a remotelocation via WAN 1104 and/or LAN 1110. For example, light fixture 1118can be coupled to dimmer 1114, such that dimmer 1114 can include a powerregulator that controls an amount of power being provided to lightfixture 1118. Alternatively, light fixture 1118 can be coupled to apower outlet 1116 that includes the power regulator which controls theamount of power to light fixture 1118, and dimmer 1114 can send commandsto power outlet 1116 via LAN 1110.

In some other embodiments, dimmer 1114 can be in a different room thanlight fixture 1118, and can control a brightness level for light fixture1118 by sending commands to power outlet 1116 via the computer network.For example, light fixture 1118 can include a stage light, and dimmer1114 may be installed within a sound and lighting control room behindthe stadium seats. A lighting technician in the control room caninteract with dimmer 1114 to control one or more light fixtures, atwhich point dimmer 1114 can generate and send device-controlling eventto one or more light fixtures via LAN 1110.

As another example, a security agency may install a plurality of lightfixtures at key locations throughout a bank (e.g., within a bank vault),so that they can be controlled remotely via a dimmer 1114 within thesecurity agency's headquarters. If a security agent desires to inspectthe bank's premises, the security agent can interact with dimmer 1114,at which point dimmer 1114 can generate and send device-controllingevent to one or more light fixtures via WAN 1104.

Recall that, in some embodiments, dimmer 1114 can maintain apeer-to-peer network connection with each target light fixture (e.g.,light fixture 1118), and can send the device-controlling event to theselight fixtures via their respective network connection. Dimmer 1114 andthe plurality of light fixtures (e.g., light fixture 1118) can maintaina network connection to a forwarding service (e.g., a forwarding serviceprovided via computer cluster 1102) via WAN 1104. Also, dimmer 1114 canprovide the device-controlling event to the forwarding service via thenetwork connection, and can indicate which light fixtures are to receivethe device-controlling event. At this point, the forwarding service cancommunicate the device-controlling event to the specified light fixturesvia the network connections between the forwarding service and thespecified light fixtures (e.g., via WAN 1104 and LAN 1110).

In some embodiments, a device of the interfacing-device network can keepa log of the events that it has performed. When dimmer 1114 receives aUI event via the touch-screen interface, dimmer 114 can store the UIevent in the log. Dimmer can also process the UI event (e.g., a fingerswipe) to determine an action to perform, and generates adevice-controlling event based on the UI event. If the user performs adownward swipe on the touch-screen interface, dimmer 1114 can determinethat the user is intending to decrease a lighting level of acorresponding light fixture 1118, and can determine a target light levelbased on a speed and/or a distance of the downward finger swipe. Dimmer1114 can also record the device-controlling event in the event log.

If dimmer 1114 is configured to control light fixture 1118 directly(e.g., via a built-in power regulator whose output is electricallycoupled to light fixture 1118), dimmer 1114 can adjust a power levelprovided to light fixture 1118 based on the device-controlling event.Also, dimmer 1114 can monitor an amount of power consumed by lightfixture 1118 after adjusting the power level, and can create an entry inthe event log to record the detected power level.

On the other hand, if dimmer 1114 is configured to control outlet 1116,dimmer 1114 can send the device-controlling event to outlet 1116. Then,when outlet 1116 receives the device-controlling event, outlet 1116 canstore the received user-control event in the log, and adjusts a powerlevel provided to light fixture 1118 based on the device-controllingevent. Dimmer 1114 can also monitor an amount of power consumed by lightfixture 1118 after adjusting the power level, and can record thedetected power level in the event log.

The controller and/or a user can compare log entries from various peerdevices in a communication chain to debug event conflicts. For example,a user 1106 may have generated a rule for dimmer 1114 that configuresdimmer 1114 to increase the brightness of light fixture 1118 to apredetermined level when a built-in motion sensor detects a motion.Thus, if a user interacts with the touch-screen interface of dimmer 1114to dim or turn off light fixture 1118, dimmer 1114 will detect theuser-control event via the touch-screen interface, and may also detect amotion-sensing event via the built-in motion sensor. These events maycause dimmer 1114 to turn on light fixture 1118 shortly after havingexecuted the user's command to dim or turn off light fixture 1118, whichmay be an unintended consequence.

Recall that when an interfacing device includes one or more rules thatproduce conflicting events, the interfacing device can process the rulesin a predetermined sequence so that the last rule executed produces thefinal outcome. Thus, if the user has created a sequence of rules that donot solve conflicts in a desirable way, the user can analyze the eventlogs for on or more interfacing devices to determine a new sequence ofrules that resolves the conflicts as desired.

For example, the user can analyze the event logs from dimmer 1114 todetermine that dimmer 1114 processes a rule associated with the motionsensor (which turns on light fixture 1118) after processing a ruleassociated with the touch-screen interface (which dims or turns offlight fixture 1118). The user can correct this by causing dimmer 1114 toprocess the rule for the touch-screen interface after processing therule associated with the motion sensor.

As another example, by analyzing the event logs, the user may determinethat after dimmer 1114 processes the user's touch-screen event to dim orturn off light fixture 1118, dimmer 1114 detects a motion-sensing eventas the user moves his hand away from the touch-screen interface. Theuser can correct this by configuring dimmer 1114 to disable the ruleassociated with the motion sensor for a predetermined period of time, oruntil the motion sensor does not detect motion for a predeterminedperiod of time.

In some embodiments, a device's log can store a number of historical logentries for a determinable time interval (e.g., log entries for the pastweek), and/or that are limited by a determinable quantity (e.g., amaximum of 1000 log entries) or a determinable file size (e.g. a maximumof 5 MB).

Configuring the Device-Interface Network

Recall that one or more computing devices can interact with thecontroller to manage and configure the interfacing-device network. Forexample, a user can interact with a personal computing device toprovision and configure a new interfacing device of theinterfacing-device network, and/or to deploy one or more rules onto theinterfacing device. Once the user commits the configurations for thedevice, the controller can add the new device to the network, and canestablish peer-to-peer network connections between the new device andother devices with which it needs to exchange real-time data.

However, in some embodiments, peer devices that reside in differentnetwork domains may not be able to establish a peer-to-peer connection.Thus, to establish network connections between the peer devices, thecontroller can configure the peer devices to communicate with each othervia a forwarding service. The forwarding service can be implemented as apart of the controller, or can be a separate Internet service availableto the peer devices of the network.

In some embodiments, the interfacing-device network includes at most onecontroller that configures the interfacing devices to operate within thenetwork. For example, computer cluster 1102 can implement a controllerfor interfacing-device network 1100. If a user needs to reconfigure thenetwork structure using a network device (e.g., laptop 1108 coupled toWAN 1104, or smartphone 1112 of LAN 1110), the network device needs tomake this network reconfiguration via the master controller.

If a second user is also interacting with the controller to configurethe network, the controller can push any changes made by the first userto the second user's computer to prevent the two users making redundantor conflicting changes to the network configuration. Also, when a usercommits his changes to the network configuration, the controller cancompile a configuration file for each affected interfacing device, andcan download the configuration file for each interfacing device beingmodified.

Note that if the connection to the centralized controller goes offline(e.g., the controller goes offline, or a LAN loses connection to theInternet), the interfacing devices can continue to process the rules andcommunicate via their peer-to-peer network connections. However, thenetwork device may not be able to reconfigure the network configuration,given that the master controller is not available to provision newinterfacing devices, to compile and distribute new or updated rules, orto reconfigure the network connections between peer interfacing devices.

In some embodiments, the interfacing-device network can include morethan one centralized controller. For example, the network can include aprimary controller that is used to make any reconfigurations to thenetwork, and can include one or more secondary or backup controllersthat can be used to reconfigure at least a portion of the network in thecase that the primary controller becomes unavailable.

FIG. 12A illustrates an exemplary system architecture 1200 that includesa primary controller 1204 and one or more LAN controllers with mirroreddatabases in accordance with an embodiment of the present invention. Forexample, primary controller 1204 can include or be coupled to a database1206 that stores configuration information and historical data for aplurality of interfacing devices (e.g., interfacing devices within LANs1208 and 1216). LAN 1208 can include a local controller 1210 coupled toa database 1212, which stores configuration information and historicaldata for interfacing devices within LAN 1208. Also, LAN 1216 can includea local controller 1218 coupled to a database 1220, which storesconfiguration information and historical data for interfacing deviceswithin LAN 1216.

In system architecture 1200, the local controllers keep their localdatabase synchronized with the primary controller's database. Database1212 can mirror a plurality of table entries of database 1206 that areassociated with devices 1214.1-1214.m of LAN 1208. Similarly, database1220 can mirror a plurality of table entries of database 1206 that areassociated with devices 1222.1-1222.n of LAN 1216. Thus, if systemarchitecture 1200 includes interfacing devices that are distributedacross a plurality of domains (e.g., across various cities), the amountof data stored by local controllers 1210 and 1218 in databases 1212 and1220 is substantially small in comparison to the amount of data storedin database 1206 by the primary controller.

In some embodiments, local controller 1210 can monitor and/or control aplurality of interfacing devices within LAN 1208. Also, an administratorcan interact with local controller 1210 to reconfigure a set of rulesthat are to be executed by interfacing devices 1214 within LAN 1210, andcontroller 1210 can reconfigure devices 1214 based on the new set ofrules. However, in some embodiments, local controller 1210 may notprovision new devices to add to the interfacing-device network, and/ormay not remove devices from the network. A system administrator can addan interfacing device to the network by interacting with primarycontroller 1204 to provision the new device. Primary controller 1204 canassign a digital certificate for the new device, configure the newdevice to establish a network connection with other peer devices (e.g.,to send or receive subscribed data), and can configure the new device toprocess a set of rules.

Controller 1210 may also be prevented from reconfiguring an existinginterface device if controller 1210 has an outdated version of thedatabase (e.g., when database 1212 becomes out of sync from a portion ofdatabase 1206 associated with LAN 1208). This requirement preventscontroller 1210 from reversing a previous configuration made by primarycontroller 1204 or any up-to-date controller (e.g., controller 1218).For example, if local controller 1210 goes offline, and controller 1204reconfigures one or more of interfacing devices 1214.1-1214.m, theconfiguration data within database 1212 can become out-of-date. Asanother example, if local controller 1210 loses communication withcentral controller 1204, and local controller 1210 reconfigures one ormore of interfacing devices 1214.1-1214.m, the configuration data withindatabase 1206 can become out-of-date.

Each interfacing device may store a configuration version number (e.g.,a strictly increasing number or a timestamp), which indicates a localunique identifier for the device's configuration. Also, each databasecan store a recent configuration version number for the devices to whichit is associated, which allows a corresponding controller to determinewhether the database is out-of-date prior to reconfiguring aninterfacing device. If the controller attempts to reconfigure anexisting interfacing device, the controller can first determine whetherthe corresponding database is up-to-date with respect to the interfacingdevice being reconfigured.

If the controller determines that its most-recent configuration versionnumber for an interfacing device matches that of the interfacing device,the controller can proceed to reconfigure the interfacing device.However, the controller can perform a remedial action if the controllerdetermines that its most-recent configuration number does not match thatof the interfacing device (e.g., its most-recent version number issmaller than that of the interfacing device). The remedial action caninclude alerting a user of the version discrepancy, and prompting theuser to specify whether he desires to reconfigure the interfacing devicebased on the older device configuration of the out-of-date database.Alternatively, the remedial action can include reconfiguring theinterfacing device at a later time after the database is broughtup-to-date.

Alternatively, in some embodiments, controller 1210 can become theprimary controller for interfacing devices within LAN 1208 in the eventthat LAN 1208 becomes decoupled from controller 1204 (e.g., LAN 1208becomes decoupled from WAN 1202, or controller 1204 goes offline).Controller 1210 can be allowed to provision interfacing devices to addto the network, or to remove interfacing devices from the network.Controller 1210 can keep track of the changes to the network withindatabase 1212. Then, once controller 1210 regains a connection tocontroller 1204, controller 1210 can provide the changes to the networkto controller 1204, and controller 1204 updates database 1206 to reflectthese changes to the network.

Also, once controller 1204 synchronizes database 1206 with database1212, controller 1210 can proceed to resign its status as a primarycontroller, at which point controller 1204 becomes the primarycontroller for LAN 1208. If a new interfacing device within LAN 1208 isto communicate with a device outside of LAN 1208, primary controller1204 can re-provision the new device so that the new device can interactwith devices outside of network 1208. For example, primary controller1204 can provide the new device with a digital certificate that is validoutside of LAN 1208, and can reconfigure the new device so that the newdevice establishes a network connection with one or more devices outsideof LAN 1208 (e.g., via a peer-to-peer channel, or via a data forwardingservice).

FIG. 12B illustrates an exemplary system architecture 1250 that includesa LAN controller within a local-area network and a forwarding serviceaccessible within a wide-area network in accordance with an embodimentof the present invention. LAN 1256 can include a primary controller 1258that can be used to configure, monitor, and/or control interfacingdevices within a local domain, as well as interfacing devices within oneor more remote domains.

Specifically, controller 1258 can be installed within LAN 1256, and caninclude or be coupled to a database 1260 that stores configurationinformation and historical data for the interfacing devices of the localand remote domains. Controller 1258 can establish a peer-to-peer networkconnection to devices 1262.1-1262.m within LAN 1256, and can establishnetwork connections to one or more interfacing devices of a remotedomain (e.g., to devices 1266.1-1266.n of LAN 1264) via data-forwardingservice 1254.

For example, controller 1258 can be installed within an organization'soffice building to manage a plurality of devices. A system administratorcan interact with controller 1258 to add an interfacing device to thenetwork, such as an mPort device coupled to a motion sensor, and anmPower device coupled to a light fixture. The system can also configurecontroller 1258 to collect real-time event data from the plurality ofinterfacing devices within an event log, which allows the administratorto study the event log in an effort to ensure the network of devices areoperating as desired.

Further, if the organization expands to other buildings, either withinthe same city or at a distant location, the administrator can configurecontroller 1258 to establish a network connection to devices at theremote location via data-forwarding service 1254. This allows controller1254 to reconfigure, control, and/or monitor devices at the remotelocation, without utilizing a central controller outside any of theorganization's local-area networks. Thus, installing controller 1258within the organization's local network allows the administrator to havecontrol over the data that is collected by the interfacing devices andis stored within database 1260, while still allowing the administratorto deploy additional devices at remote locations.

In some embodiments, the administrator can also interact with controller1258 and/or any of the interfacing devices while the administrator isnot within any of the organization's local-area networks. Theadministrator can install an application on a personal computing device(e.g., a smartphone 1268), which has access to WAN 1252 (e.g., via acellular network), and that communicates with central controller 1258and/or with the interfacing devices via the data-forwarding service1254. Alternatively, the administrator can use an Internet web browserto access a web-based interface hosted by controller 1258 byestablishing a connection to controller 1258 via data-forwarding service1254.

In some embodiments, system architecture 1250 can include a backupcontroller accessible via WAN 1252, which includes or is coupled to adatabase that mirrors database 1260. In the event that primarycontroller 1258 goes offline, the backup controller can temporarilybecome the primary controller. This allows the administrator to interactwith the backup controller (e.g., using smartphone 1268) to add orremove devices to/from the interfacing device network and/or toreconfigure an existing interfacing device.

FIG. 13 illustrates an exemplary computer system for intelligentmonitoring and controlling of devices in accordance with one embodimentof the present invention. In one embodiment, a computer andcommunication system 1300 includes a processor 1302, a memory 1304, anda storage device 1306. Storage device 1306 stores an intelligentmonitor-and control application 1308, as well as other applications anddata (e.g., additional applications 1310 and 1312). During operation,intelligent monitor-and control application 1308 is loaded from storagedevice 1306 into memory 1304 and then executed by processor 1302 tomonitor data from a plurality of interfacing devices, to configure aninterfacing device, and/or to control a state of an interfacing device.While executing the program, processor 1302 performs the aforementionedfunctions. Computer and communication system 1300 can also be coupled toa display 1314, a keyboard 1316, and a pointing device 1318. Thedisplay, keyboard, and pointing device can facilitate a user to monitor,configure, and/or control one or more interfacing devices.

One embodiment of the present invention provides a device-controllingsystem that configures, monitors, and controls one or more interfacingdevices, such that an interfacing device can obtain and disseminatesensor data from one or more attached physical devices that includesensors for measuring physical attributes. During operation, the systemcan configure an interfacing device by establishing a network connectionwith the interfacing device, and determining one or more rules for theinterfacing device. A rule can indicate an action description forperforming an action, and indicates a condition that indicates criteriafor processing the rule's action description. The system can configurethe interfacing device to process its associated rules.

In some variations to this embodiment, the system configures theinterfacing device to send recent sensor data to the device-controllingcomputer, and the system uses this data to configure or control one ormore interfacing devices. When the system determines that a ruleassociated with the interfacing device is satisfied based on recent datafrom one or more interfacing devices, the system modifies theinterfacing device's operating state based on the rule's actiondescription.

In some variations to this embodiment, the system configures one or moreinterfacing devices to facilitate distributed rule processing. Toconfigure the interfacing device, the system programs the interfacingdevice to process the one or more rules. The system also determining oneor more other devices that generate sensor data associated with the oneor more rules for the interfacing device, and configures the interfacingdevice to subscribe to sensor data from the one or more other devices.

In some embodiments, the system can receive a request, from a clientdevice, to obtain a device-monitoring UI The system can present thedevice-monitoring UI by obtaining data associated with one or moreinterfacing devices for the device-monitoring UI, and providing thedevice-monitoring UI to the client device so that the device-monitoringUI presents sensor data from the one or more interfacing devices.

In some variations to these embodiments, the data associated with aninterfacing device includes device-accessing information for theinterfacing device, which the client device can use to obtain real-timesensor data for the device-monitoring UI directly from the respectiveinterfacing device.

In some variations to these embodiments, the data associated with aninterfacing device includes a geographic location. Also, to provide thedevice-monitoring UI, the system can obtain a map that covers ageographic area associated with at least one interfacing device. Thesystem then generates the device-monitoring UI to display the obtainedmap, and to overlay the at least one interfacing device over the map.

In some variations to these embodiments, the data associated with arespective device includes a set of image coordinates. Thus, when thesystem provides the device-monitoring UI, the system can obtain an imageof an area associated with at least one interfacing device. The systemthen generates the device-monitoring UI to display the obtained image,and to overlay the at least one interfacing device over the obtainedimage. The obtained image can include a frame from a real-time videofeed, and the system can periodically update the device-monitoring UI todisplay a recent frame from the real-time video feed.

In some variations to these embodiments, the real-time video feed caninclude a video feed from a pan-tilt-zoom (PTZ) camera. Thus, while thesystem provides the device-monitoring UI, the system can map the imagecoordinates for an interfacing device to a set of coordinates associatedwith the frame from the PTZ camera. When the camera's orientationchanges, the system can update the device-monitoring UI to overlay theinterfacing device over the recent frame based on the mapped imagecoordinates.

In some embodiments, a user-definable rule can include a compound rulethat is associated with multiple physical devices.

In some embodiments, the system can receiving a command, from a clientdevice, to control an interfacing device. The system then determines anestablished network connection for communicating with the interfacingdevice, and configures the interfacing device, via the networkconnection, as indicated by the received command.

The system can also receive, from a client device, a request to obtain arule-configuring UI. The rule-configuring UI can indicate one or moreexisting rules for one or more interfacing devices, and facilitatescreating or modifying new or existing rules. Then, in response toreceiving a description for a rule, the system determines one or moretarget interfacing devices that process at least a portion of the rule'saction description. The system then generates a device-specific rule fora target device, such that the device-specific rule includes a portionof the rule's action description that is to be processed by the targetdevice. The system then configures the target device to process thedevice-specific rule.

In some variations to the embodiments, while configuring the interfacingdevice, the system can determine a geographic location for theinterfacing device, and/or can determine a description for one or morephysical devices coupled to the interfacing device. Also, the system cangenerate a digital certificate for the interfacing device, and/or canprovision the interfacing device based at least on the digitalcertificate.

One embodiment of the present invention provides a data-forwardingsystem that establishes a network connection to a plurality of networkdevices to facilitate an interfacing device communicating with adevice-controlling system, a peer interfacing device, or other computingdevices. During operation, when the system receives data from a networkdevice, the system determines a peer network device that is to receivethe data, such as a device that is subscribed to receive the data. Thesystem can forward the sensor data to the peer network device bydetermining an established network connection for communicating with thesecond network device, and sending the sensor data to the peer networkdevice via the established network connection.

In some embodiments, to determine a second network device that issubscribed to the received sensor data, the system searches through adata-subscription repository, which stores data-subscription requestsfor a plurality of network devices, to obtain a stored data-subscriptionrequest associated with the received sensor data. The system thenidentifies an interfacing device that is subscribed to the receivedsensor data based on the stored data-subscription request.

In some embodiments, the system implements a data-forwarding servicethat receives a data-subscription request from the first network device.The data-subscription request indicates a data-supplying interfacingdevice, and also indicates sensor data supplied by the data-supplyinginterfacing device. The system then stores the data-subscription, in thedata-subscription repository, in association with the first networkdevice. The system also forwards the data-subscription request to thedata-supplying interfacing device.

In some embodiments, while establishing the network connection, thesystem receives a request from a network device to establish the networkconnection, and the system determines device-accessing information forthe network device based on the request. The system stores thedevice-accessing information in association with the network device, andestablishes the network connection with the network device based on thedevice-accessing information.

In some embodiments, the system establishes the network connection usinga WebSocket protocol, a Session Traversal Utilities forNetwork-address-translation (STUN) protocol, and/or a Comet protocol.

In some variations to these embodiments, when establishing the networkconnection using the WebSocket protocol, the request can include aWebSocket handshake request to upgrade a hypertext transfer protocol(HTTP) session to a WebSocket session, and can include aSec-WebSocket-Key token from the network device. The system can storethe Sec-WebSocket-Key in association with the network device, andgenerates a Sec-WebSocket-Accept token for the interfacing device basedon the Sec-WebSocket-Key. The system then sends to the interfacingdevice a response which acknowledges a persistent Web Socketcommunication channel, such that the response includes at least theSec-WebSocket-Accept token for the interfacing device.

In some variations to these embodiments, when establishing the networkconnection using the STUN protocol, the system receives a bindingrequest that indicates network-addressing information for the networkdevice, and stores the network-addressing information in associationwith the network device. The network-addressing information can includeat least one or more of a network address and a port number.

In some variations to these embodiments, when establishing the networkconnection using the Comet protocol, the system receives a long-pollingrequest from the network device, and determines network-addressinginformation for the network device based on the long-polling request.The network-addressing information includes at least one or more of anetwork address and a port number. The system stores thenetwork-addressing information in association with the network device,which facilitates accessing the network connection at a later time.

In some embodiments, the device-accessing information can include anetwork address for the network device, a port number for the networkdevice, and/or a unique identifier for the network device. Thedevice-accessing information can also include authenticationinformation, such as a digital certificate assigned to the networkdevice, login credentials associated with the network device, etc.

In some embodiments, the system can determine the device-accessinginformation by determining the network address and/or the port numberfor the network device based on the message header from a network packetthat includes the request.

In some embodiments, the network device can include a sensor-interfacingdevice, a power outlet, a power strip, a light dimmer, a light switch,or a client computing device.

One embodiment of the present invention provides an interfacing devicethat communicates with other devices over an established networkconnection to send and/or receive real-time sensor data. Duringoperation, the local interfacing device can establish a networkconnection with a remote network device, such as with a peer interfacingdevice, or a data-forwarding system. The device can maintain datasubscriptions to other peer devices by selecting a rule that takessensor data from one or more remote interfacing devices as input, andgenerating a data-subscription request for a sensor data elementassociated with the rule. The data-subscription request indicates adata-supplying interfacing device, and further indicates sensor datasupplied by the data-supplying interfacing device. The device then sendsthe data-subscription request to the remote device via the establishednetwork connection.

In some embodiments, the remote device can include a remote peer deviceassociated with the data-subscription request, or a data-forwardingdevice configured to maintain a network connection between the localnetwork device and a remote peer device associated with thedata-subscription request.

In some embodiments, the local interfacing device can store the rule ina rule repository. Then, when the device receives sensor data via theestablished network connection, and in response to determining that thereceived sensor data is associated with the stored rule, the deviceprocesses the rule based at least on the received sensor data.

In some embodiments, the local interfacing device can obtain sensor datafrom a local physical device, such that the physical device can includea sensor for measuring one or more physical attributes. If theinterfacing device determines that the remote device is subscribed tothe obtained sensor data, the interfacing device sends the sensor datato the remote device via the established network connection.

In some embodiments, the local interfacing device establishes thenetwork connection using a WebSocket protocol, a Session TraversalUtilities for Network-address-translation (STUN) protocol, and/or aComet protocol.

In some variations to these embodiments, the request can include aWebSocket handshake request to upgrade a hypertext transfer protocol(HTTP) session to a WebSocket session, and can include aSec-WebSocket-Key token from the network device. Also, when establishingthe network connection using the WebSocket protocol, the localinterfacing device can store the Sec-WebSocket-Key in association withthe remote device, and generates a Sec-WebSocket-Accept token for theremote device based on the Sec-WebSocket-Key. The local interfacingdevice then sends to the remote device a response which acknowledges apersistent WebSocket communication channel, such that the responseincludes at least the Sec-WebSocket-Accept token for the remote device.

In some variations to these embodiments, when establishing the networkconnection using the STUN protocol, the local interfacing devicereceives a binding request that indicates network-addressing informationfor the remote device, and stores the network-addressing information inassociation with the remote device. The network-addressing informationcan include at least one or more of a network address and a port number.

In some variations to these embodiments, when establishing the networkconnection using the Comet protocol, the local interfacing devicereceives a long-polling request from the remote device, and determinesnetwork-addressing information for the remote device based on thelong-polling request. The network-addressing information includes atleast one or more of a network address and a port number. The localinterfacing device stores the network-addressing information inassociation with the remote device, which facilitates accessing thenetwork connection at a later time.

One embodiment of the present invention provides a local controller thatmaintains a local database which stores information associated with aset of interfacing devices of a local-area network. The local databasecan include a database mirror for a remote database, of a remotecontroller, that stores information for a set of provisioned interfacingdevices. During normal operation, a remote controller hosting the remotedatabase can have primary control of interfacing devices within thelocal area network and/or other network domains, and the localcontroller maintains the local database to include at least a subset ofthe remote database. However, when the local controller determines thatthe remote controller has gone offline, the local controller can obtainprimary control of interfacing devices within the local area network.

In some embodiments, while configuring the local network controller toobtain primary control of the local area network, the local controlleris enabled to monitor interfacing devices of the local area network, toreconfigure an interfacing device of the local area network, and/or tocontrol an interfacing device of the local area network.

In some embodiments, the local controller is not configured to add aninterfacing device to the interfacing-device network, or to remove aninterfacing device from the set of provisioned interfacing devices.

In some embodiments, while obtaining primary control of the local areanetwork, the local controller determines that the local database issynchronized with a latest version of the remote database.

In some embodiments, in response to determining that the local databaseand the remote database are synchronized, the local controller isconfigured to obtain primary control of the local area network. Toobtain primary control of the local area network, the local controlleris enabled to add a new interfacing device to the set of provisionedinterfacing devices, and to remove an interfacing device from the set ofprovisioned interfacing devices.

In some embodiments, the local controller is configured to rescindprimary control of the local area network, in response to determiningthat a remote controller that hosts the remote database has come online.

In some embodiments, whileto rescinding primary control of the localarea network, the local controller synchronizes the local database withthe remote database.

One embodiment provides an interfacing device that is configured toprocess one or more rules, based on sensor data, to perform apredetermined action. During operation, the device can receive a deviceconfiguration that includes a rule for the interfacing device. The rulecan include an action description for performing an action, and caninclude a condition that takes sensor data as input and indicatescriteria for performing the action. The device can store the rule in arule repository, and determines a remote interfacing device thatgenerates a piece of data associated with the rule's condition. Thedevice can also subscribe to the piece of data from the remoteinterfacing device.

In some embodiments, the local interfacing device establishes a networkconnection with the remote interfacing device, and subscribes to thedata from the remote interfacing device via the established connection.

In some embodiments, while establishing the network connection, thelocal interfacing devices establishes a peer-to-peer network connectionwith the remote interfacing device.

In some embodiments, the local interfacing device establishes thenetwork connection using a WebSocket protocol, a Session TraversalUtilities for Network-address-translation (STUN) protocol, and/or aComet protocol.

In some embodiments, while establishing the network connection, if thelocal interfacing device determines that the remote interfacing deviceis not reachable via a peer-to-peer communication channel, the localinterfacing device establishes the network connection via adata-forwarding service.

In some embodiments, when the local interfacing device obtains sensordata, the local interfacing device selects a rule to process based onthe sensor data. If the local interfacing device determines that therule's condition is satisfied, and the local interfacing deviceprocesses the rule's action description to perform the action.

In some embodiments, the local interfacing device obtains sensor datafrom a local or remote physical device that measures one or morephysical attributes, and/or from a network controller which monitorsand/or configures one or more interfacing devices.

In some embodiments, while selecting the rule to process, the localinterfacing device selects a set of rules whose condition takes theobtained data as input, and determines a user-specified ordering for theset of rules. The user-specified ordering indicates an order in whichthe rules are to be processed. The local interfacing device then selectsa rule, from the set of rules, based on the user-specified ordering.

In some embodiments, the local interfacing device obtains sensor data byperiodically monitoring a data value from a physical device coupled tothe interfacing device. Also, if the local interfacing device determinesthat the obtained data satisfies a data-subscription request from aremote interfacing device, the local interfacing device communicates theobtained data to the remote interfacing device.

In some embodiments, the local interfacing device can communicate thedata to the remote interfacing device by communicating the data via anestablished network connection, which has been established forcommunicating with the remote interfacing device.

One embodiment provides a sensor-monitoring interfacing device, coupledto one or more physical devices that include sensors for measuringphysical attributes. During operation, the interfacing device obtainsand processes sensor data from the physical devices. When theinterfacing device obtains sensor data from a physical device, theinterfacing device selects a rule to process based on the obtainedsensor data. If the interfacing device determines that the rule'scondition is satisfied, the interfacing device can process the rule'saction description to perform a corresponding action.

In some embodiments, the physical device can include a temperaturesensor, a humidity sensor, a voltage sensor, a current sensor, a motionsensor, a light sensor, a moisture sensor a digital-value sensor, and/ora door/window sensor.

In some embodiments, the action can include sending a predeterminedsignal pattern over a serial port, and/or sending a predetermined signalpattern over one or more general-purpose output pins. Also, the actioncan include processing a predetermined script to configure a peripheraldevice via a serial port, sending an email message to a predeterminedrecipient, creating a system alert, generating an event for an eventlog, and/or computing a data value based in part on the received sensordata.

In some embodiments, if the local interfacing device determines that thesensor data satisfies a data-subscription request from a remoteinterfacing device, the interfacing device communicates the sensor datato the remote interfacing device.

In some embodiments, the data-subscription request indicates canindicate a minimum threshold value for the sensor data, a maximumthreshold value for the sensor data, a time duration since a previouspiece of sensor data was provided to the remote interfacing device,and/or a difference threshold between the obtained sensor data and aprevious piece of sensor data that was provided to the remoteinterfacing device.

In some embodiments, while communicating the data to the remoteinterfacing device, the local interfacing device can communicate thedata via an established peer-to-peer network-connection associated withthe remote interfacing device.

In some embodiments, while selecting the rule to process, the localinterfacing device selects a set of rules whose condition takes theobtained data as input, and determines a user-specified ordering for theset of rules. The user-specified ordering indicates an order in whichthe rules are to be processed. The local interfacing device then selectsa rule based on the user-specified ordering.

In some embodiments, the local interfacing device can adjust a color ofa light-emitting diode (LED) indicator based on determining that theinterfacing device is in a factory-default mode. The local interfacingdevice can adjust a color of a light-emitting diode indicator based ondetermining that the interfacing device is provisioned by a networkcontroller that monitors or controls one or more interfacing devices,and/or determining that the interfacing device is being monitored by thenetwork controller.

One embodiment provides a load-controlling interfacing device thatobtains and processes sensor data from a user interface and/or otherdevices, and that processes rules based on the sensor data to control anelectrical load, such as a light fixture. During operation, when theinterfacing device obtains sensor data, the interfacing device selects arule to process based on the sensor data from the user interface. If theinterfacing device determines that the rule's condition is satisfied,the interfacing device can process the rule's action description toperform a corresponding action for controlling power to the electricalload.

In some embodiments, the electrical load includes a light fixture.

In some embodiments, the event data includes sensor data from a atouch-screen user interface. The touch-screen user interface can includea capacitive-touch surface area, a resistive-touch surface area, aproximity sensor, and/or a motion sensor.

In some embodiments, the event data from the touch-screen user interfacecan indicate a portion of the touch-screen user interface that wastouched by a local user, a detected object within a determinabledistance from the touch-screen user interface, and/or a detected motion.

In some embodiments, while obtaining the event data, the interfaceingdevice processes information from the touch-screen UI to determine agesture. The gesture can include an upward finger swipe for increasing alight intensity of the light fixture, a downward finger swipe fordecreasing a light intensity of the light fixture, a finger tap foractivating or deactivating power to the light fixture, and/or a fingertap for adjusting the light fixture's light intensity to a determinablelevel.

In some embodiments, the interfacing device can determine that the eventdata satisfies a data-subscription request from a remote interfacingdevice, and communicates the event data to the remote interfacingdevice.

In some embodiments, the remote-interfacing device is electricallycoupled to a corresponding light fixture, and the remote-interfacingdevice can be configured to adjust power to the corresponding lightfixture based on the event data.

One embodiment provides a load-monitoring interfacing device thatobtains and processes sensor data from an electrical load. Theinterfacing device can include at least one power outlet to providepower to a corresponding electrical load. During operation, theinterfacing device can obtain sensor data from a local power outletcoupled to an electrical load, such that the sensor data can indicate anelectrical measurement associated with the electrical load. Theinterfacing device selects a rule to process based on the obtainedsensor data, and processes the rule to determine whether to perform anaction. If the rule's condition is satisfied, the interfacing deviceproceeds to processing the rule's action description to perform theaction, such as to enable or disable a power outlet, or to perform anyother pre-defined action.

In some embodiments, the sensor data from the power outlet can include apower state for the corresponding electrical load, a currentmeasurement, and/or a voltage measurement.

In some embodiments, the action can include activating a power outlet,deactivating a power outlet, modulating a voltage provided by an outlet,and/or modulating an amount of current provided by a power outlet. Also,the action can include sending an email message to a predeterminedrecipient, creating a system alert, generating an event for an eventlog, and/or computing a data value based in part on the received sensordata.

The data structures and code described in this detailed description aretypically stored on a computer-readable storage medium, which may be anydevice or medium that can store code and/or data for use by a computersystem. The computer-readable storage medium includes, but is notlimited to, volatile memory, non-volatile memory, magnetic and opticalstorage devices such as disk drives, magnetic tape, CDs (compact discs),DVDs (digital versatile discs or digital video discs), or other mediacapable of storing computer-readable media now known or later developed.

The methods and processes described in the detailed description sectioncan be embodied as code and/or data, which can be stored in acomputer-readable storage medium as described above. When a computersystem reads and executes the code and/or data stored on thecomputer-readable storage medium, the computer system performs themethods and processes embodied as data structures and code and storedwithin the computer-readable storage medium.

Furthermore, methods and processes described herein can be included inhardware modules or apparatus. These modules or apparatus may include,but are not limited to, an application-specific integrated circuit(ASIC) chip, a field-programmable gate array (FPGA), a dedicated orshared processor that executes a particular software module or a pieceof code at a particular time, and/or other programmable-logic devicesnow known or later developed. When the hardware modules or apparatus areactivated, they perform the methods and processes included within them.

The foregoing descriptions of various embodiments have been presentedonly for purposes of illustration and description. They are not intendedto be exhaustive or to limit the present invention to the formsdisclosed. Accordingly, many modifications and variations will beapparent to practitioners skilled in the art. Additionally, the abovedisclosure is not intended to limit the present invention.

What is claimed is:
 1. A method, comprising: establishing a networkconnection with one or more network devices; responsive to receivingsensor data from a first network device, determining a second networkdevice that is subscribed to the received sensor data; determining anestablished network connection for communicating with the second networkdevice; and sending the sensor data to the second network device via theestablished network connection.
 2. The method of claim 1, whereindetermining the second network device that is subscribed to the receivedsensor data involves: searching, through a data-subscription repository,for a stored data-subscription request associated with the receivedsensor data, wherein the data-subscription repository storesdata-subscription requests for a plurality of network devices; andidentifying an interfacing device that is subscribed to the receivedsensor data based on the stored data-subscription request.
 3. The methodof claim 2, further comprising: receiving, by a data-forwarding device,a data-subscription request from the first network device, wherein thedata-subscription request indicates a data-supplying interfacing device,and further indicates sensor data supplied by the data-supplyinginterfacing device; storing the data-subscription, in thedata-subscription repository, in association with the first networkdevice; and forwarding the data-subscription request to thedata-supplying interfacing device.
 4. The method of claim 1, whereinestablishing the network connection involves: receiving a request from anetwork device to establish the network connection; determiningdevice-accessing information for the network device based on therequest; storing the device-accessing information in association withthe network device; and establishing the network connection with thenetwork device based on the device-accessing information.
 5. The methodof claim 4, wherein establishing the network connection involves usingat least one protocol selected from the group consisting of: a WebSocketprotocol; a Session Traversal Utilities for Network-address-translation(STUN) protocol; and a Comet protocol.
 6. The method of claim 5, whereinthe request for establishing the network connection using the WebSocketprotocol includes at least one of: a WebSocket handshake request toupgrade a hypertext transfer protocol (HTTP) session to a WebSocketsession; and a Sec-WebSocket-Key token from the network device.
 7. Themethod of claim 6, wherein establishing the network connection using theWebSocket protocol further involves: storing the Sec-WebSocket-Key inassociation with the network device; generating a Sec-WebSocket-Accepttoken for the interfacing device based on the Sec-WebSocket-Key; andsending to the interfacing device a response which acknowledges apersistent WebSocket communication channel, wherein the responseincludes at least the Sec-WebSocket-Accept token for the interfacingdevice.
 8. The method of claim 5, wherein establishing the networkconnection using the STUN protocol involves: receiving a binding requestthat indicates network-addressing information for the network device,wherein the network-addressing information includes at least one or moreof a network address and a port number; and storing thenetwork-addressing information in association with the network device.9. The method of claim 5, wherein establishing the network connectionusing the Comet protocol involves: receiving a long-polling request fromthe network device; determining network-addressing information for thenetwork device based on the long-polling request, wherein thenetwork-addressing information includes at least one or more of anetwork address and a port number; and storing the network-addressinginformation in association with the network device.
 10. The method ofclaim 4, wherein the device-accessing information includes one or moreof: a network address for the network device; a port number for thenetwork device; a unique identifier for the network device; a digitalcertificate assigned to the network device; and login credentialsassociated with the network device.
 11. The method of claim 1, whereinthe network device includes one or more of: a sensor-interfacing device;a power outlet; a power strip; a light dimmer; a light switch; and aclient computing device.
 12. A non-transitory computer-readable storagemedium storing instructions that when executed by a computer cause thecomputer to perform a method, the method comprising: establishing anetwork connection with one or more network devices; responsive toreceiving sensor data from a first network device, determining a secondnetwork device that is subscribed to the received sensor data;determining an established network connection for communicating with thesecond network device; and sending the sensor data to the second networkdevice via the established network connection.
 13. The storage medium ofclaim 12, wherein determining the second network device that issubscribed to the received sensor data involves: searching, through adata-subscription repository, for a stored data-subscription requestassociated with the received sensor data, wherein the data-subscriptionrepository stores data-subscription requests for a plurality of networkdevices; and identifying an interfacing device that is subscribed to thereceived sensor data based on the stored data-subscription request. 14.The storage medium of claim 13, wherein the method further comprises:receiving a data-subscription request from the first network device,wherein the data-subscription request indicates a data-supplyinginterfacing device, and further indicates sensor data supplied by thedata-supplying interfacing device; storing the data-subscription, in thedata-subscription repository, in association with the first networkdevice; and forwarding the data-subscription request to thedata-supplying interfacing device.
 15. The storage medium of claim 14,wherein establishing the network connection involves: receiving arequest from a network device to establish the network connection;determining device-accessing information for the network device based onthe request; storing the device-accessing information in associationwith the network device; and establishing the network connection tocommunicate with the network device based on the device-accessinginformation.
 16. The storage medium of claim 15, wherein establishingthe network connection involves using at least one protocol selectedfrom the group consisting of: a WebSocket protocol; a Session TraversalUtilities for Network-address-translation (STUN) protocol; and a Cometprotocol.
 17. The storage medium of claim 16, wherein the request forestablishing the network connection using the WebSocket protocolincludes at least one of: a WebSocket handshake request to upgrade ahypertext transfer protocol (HTTP) session to a WebSocket session; and aSec-WebSocket-Key token from the network device.
 18. The storage mediumof claim 17, wherein establishing the network connection using theWebSocket protocol further involves: storing the Sec-WebSocket-Key inassociation with the network device; generating a Sec-WebSocket-Accepttoken for the interfacing device based on the Sec-WebSocket-Key; andsending to the interfacing device a response which acknowledges thepersistent WebSocket communication channel, wherein the responseincludes at least the Sec-WebSocket-Accept token for the interfacingdevice.
 19. The storage medium of claim 18, wherein establishing thenetwork connection using the STUN protocol involves: receiving a bindingrequest that indicates network-addressing information for the networkdevice, wherein the network-addressing information includes at least oneor more of a network address and a port number; and storing thenetwork-addressing information in association with the network device.20. The storage medium of claim 18, wherein establishing the networkconnection using the Comet protocol involves: receiving a long-pollingrequest from the network device; determining network-addressinginformation for the network device based on the long-polling request,wherein the network-addressing information includes at least one or moreof a network address and a port number; and storing thenetwork-addressing information in association with the network device.21. The storage medium of claim 12, wherein the network device includesone or more of: a sensor-interfacing device; a power outlet; a powerstrip; a light dimmer; a light switch; and a client computing device.22. An apparatus, comprising: a communication module to establish anetwork connection with one or more network devices; a sensor-monitoringmodule to receive sensor data from the one or more network devices; anda data-subscription module, wherein responsive to the sensor-monitoringmodule receiving sensor data from a first network device, thedata-subscription module is configured to: determine a second networkdevice that is subscribed to the received sensor data; determining anestablished network connection for communicating with the second networkdevice; and configure the communication module to send the sensor datato the second network device via the established network connection. 23.The apparatus of claim 22, wherein while determining the second networkdevice, the data-subscription module is further configured to: search,through a data-subscription repository, for a stored data-subscriptionrequest associated with the received sensor data, wherein thedata-subscription repository stores data-subscription requests for aplurality of network devices; and identify an interfacing device that issubscribed to the received sensor data based on the storeddata-subscription request.
 24. The apparatus of claim 23, wherein thecommunication module is further configured to receive adata-subscription request from the first network device, wherein thedata-subscription request indicates a data-supplying interfacing device,and further indicates sensor data supplied by the data-supplyinginterfacing device; and wherein the data-subscription module is furtherconfigured to: store the data-subscription, in the data-subscriptionrepository, in association with the first network device; and configurethe communication module to forward the data-subscription request to thedata-supplying interfacing device.
 25. The apparatus of claim 24,wherein while establishing the network connection, the communicationmodule is further configured to: receive a request from a network deviceto establish the network connection; determine device-accessinginformation for the network device based on the request; store thedevice-accessing information in association with the network device; andestablish the network connection with the network device based on thedevice-accessing information.
 26. The apparatus of claim 25, whereinwhile establishing the network connection, the communication module isfurther configured to use at least one protocol selected from the groupconsisting of: a WebSocket protocol; a Session Traversal Utilities forNetwork-address-translation (STUN) protocol; and a Comet protocol. 27.The apparatus of claim 26, wherein the request for establishing thenetwork connection using the WebSocket protocol includes at least oneof: a WebSocket handshake request to upgrade a hypertext transferprotocol (HTTP) session to a WebSocket session; and a Sec-WebSocket-Keytoken from the network device.
 28. The apparatus of claim 27, whereinwhile establishing the network connection using the WebSocket protocol,the communication module is further configured to: store theSec-WebSocket-Key in association with the network device; generate aSec-WebSocket-Accept token for the interfacing device based on theSec-WebSocket-Key; and send to the interfacing device a response whichacknowledges the persistent WebSocket communication channel, wherein theresponse includes at least the Sec-WebSocket-Accept token for theinterfacing device.
 29. The apparatus of claim 26, wherein whileestablishing the network connection using the STUN protocol, thecommunication module is further configured to: receive a binding requestthat indicates network-addressing information for the network device,wherein the network-addressing information includes at least one or moreof a network address and a port number; and store the network-addressinginformation in association with the network device.
 30. The apparatus ofclaim 26, wherein while establishing the network connection using theComet protocol, the communication module is further configured to:receive a long-polling request from the network device; determinenetwork-addressing information for the network device based on thelong-polling request, wherein the network-addressing informationincludes at least one or more of a network address and a port number;and store the network-addressing information in association with thenetwork device.